Reputation: 1575
I get an AttributeError
exception when I try to run the following code on a WebFaction production server (it works in development):
#forms.py
class UserRegistrationForm(forms.ModelForm):
full_name = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Your full name'}))
email = forms.CharField(widget=forms.EmailInput(attrs={'placeholder':'Activation email will be sent'}))
password = forms.CharField(widget=forms.PasswordInput)
meal_package = forms.ModelChoiceField(queryset=Package.objects.all(), widget=forms.RadioSelect(), empty_label=None)
mobile = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'You will recieve a call on this number'}))
area_name = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Name of your area'}))
building_name = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Name of your building'}))
room_no = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Your apartment number'}))
class Meta:
model = User
fields = ['full_name', 'email', 'password', 'meal_package' ,'mobile', 'area_name', 'building_name', 'room_no']
This is the error:
File "/home/hammad/webapps/feastymeals/Feasty-Meals/Users/forms.py", line 27, in <module>
class UserRegistrationForm(forms.ModelForm):
File "/home/hammad/webapps/feastymeals/Feasty-Meals/Users/forms.py", line 29, in UserRegistrationForm
email = forms.CharField(widget=forms.EmailInput(attrs={'placeholder':'Activation email will be sent'}))
AttributeError: 'module' object has no attribute 'EmailInput'
Upvotes: 1
Views: 771
Reputation: 599648
EmailInput is a new attribute in version 1.6. You might want verify that you are using version 1.6 on the server where the code is throwing an error. If you are using an older version you cannot use that attribute, which is likely why it works on one machine and not on another.
Upvotes: 5