hello all, 

I am trying to make a registration form using User model so  i am using 
ModelForm 

as I am using bootstrap template i need to add some atribute like class 
placeholder 

so i am using widget, am facing a problem , i searchd a lot but unable to 
find the solution 

please help 

my code is under 


####################################################################

error :- name 'self' is not defined
on borwser 

######################################################################3

forms.py 


class RegistrationForm(ModelForm):

class Meta:
model = User
fields = [ 'username', 'password', 'email' ]

def __init__(self, *args, **kwargs): 
    super(RegistrationForm, self).__init__(*args, **kwargs)

    self.fields['username'].widget = forms.TextInput(attrs={"placeholder" : 
"First Name", 
            "name" : "first_name"})

    self.fields['email'].widget = forms.TextInput(attrs={"placeholder" : 
"Email Address", 
            "name" : "email"})

        self.fields['password'].widget = forms.PasswordInput(attrs={
        "placeholder" : "Password", "name" : "password", "class" : 
"form-control input-sm"})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f49cc9c1-9da4-4ff0-9b88-e5009039d570%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to