views:

30

answers:

1

so I have 2 classes

this one:

class updateForm(forms.Form):
address = forms.CharField(
                        max_length = 255,
                        label      = 'Home Address', 
                        )
cnp    = forms.CharField(
                        max_length = 15,
                        label      = 'CNP',
                        )
phoneNumber = forms.CharField(
                             max_length = 30,
                             label      = 'Phone number',
                             )
token =  forms.CharField(
                        max_length = 20,
                        label      = 'token',
                        )
oldPass = forms.CharField(
                          widget     = forms.PasswordInput,
                          max_length = 30,
                          label      = 'Old Password',
                         )
newPass = forms.CharField(
                          widget     = forms.PasswordInput,
                          max_length = 30,
                          label      = 'New Password',
                         )                                     
retypePass = forms.CharField(
                             widget     = forms.PasswordInput,
                             max_length = 30,
                             label      = 'Retype Password',
                            )

and this one:

class BaseUsernameForm(forms.Form):
username = forms.CharField(max_length=255,
                           label='Username')
def clean_username(self):
    username = self.cleaned_data['username']
    return _clean_username(username)

class BasePasswordForm(forms.Form):
    password = forms.CharField(max_length=255,
                           widget=forms.PasswordInput,
                           label='Password')

class LoginForm(BaseUsernameForm, BasePasswordForm):
    pass

after I login in ... and get to the page where the updateForm is ... i get the token and oldPass field autofiled with the token: username and oldPass: password from the loginForm ... why ?

In the html they dont share any id or class ... how can I prevent this ?

+2  A: 

Maybe the values are filled in by your browser? Try a autocomplete="OFF" for the token and oldPass input field to get something like this:

<input type="text" autocomplete="OFF" name="token"/>
aeby
Yeah I used this ... I found out I can do smth like name = forms.CharField( widget=forms.TextInput(attrs={'class':'special'})) - but I use a form.html and I dont need wanna bump into this again when I use this form and I did this <form action="." method="POST" autocomplete="OFF" >Thx for the reply :) PS: Dont know how to make the "code" tags in the comments ...
void