I recently upgraded to Django 1.7.4 and had to change the deprecated localflavor import.
Here is the new code:
from django import forms
from localflavor.us.forms import USPhoneNumberField
class ContactUsForm(forms.Form):
first_name = forms.CharField(required=False, label="First Name")
last_name = forms.CharField(required=False, label="Last Name")
phone = USPhoneNumberField(required=False, label="Phone")
email = forms.EmailField(label="Email")
message = forms.CharField(label="Your Message")
When the code runs, I get an error:
ImportError at /mypage
No module named localflavor.us.forms
Request Method: GET
Request URL: http://test.mysite.com/mypage
Django Version: 1.7.4
Exception Type: ImportError
Exception Value:
No module named localflavor.us.forms
Exception Location: /var/www/mysite-test/mysite/apps/marketing/forms.py in <module>, line 2
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
['/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/var/www/mysite-test',
'/var/www/mysite-test/mysite']
localflavor
is now a third party app (as your import shows).
You must install it: https://github.com/django/django-localflavor
pip install django-localflavor
https://django-localflavor.readthedocs.org/en/latest/#installation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With