1

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'

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.