Skip to content
Advertisement

Django form: phone field not showing

I would like to create a contact form on my Django website. For now, this is my code:

models.py:

JavaScript

forms.py:

JavaScript

views.py:

JavaScript

html:

JavaScript

I of course installed phonenumber_field and added it in settings.py

This is the result, phone field missing: form

Any help is hugely appreciated! Thanks for your time.

Advertisement

Answer

You used a model field, whereas for a form, you need a form field:

JavaScript
Advertisement