Anil, please beware that there are lots of code posted on the internet,
many of which are faulty or at least don't follow best or standard
practices. Copy & pasting will bite you, sooner or later. I recommend you
to go over the (excellent) documentation of Django before actually working
with so
Ah, I missed that you included your model in your original email. You're
definitely using a custom User class (anything other than
django.contrib.auth.models.User), which explains why it can't find the
set_password() method.
Which version of Django are you developing with? If you definitely need t
No, I am not using the custom user model, but it seems like I should be? (even
though, I don't think I am changing anything that requires this). I still have
user name as the authenticator.
When I subclass UserCreationForm, it was complaining about not having password1
and 2 not in my form.
On
Are you using a custom User model? Your code is very similar to the
UserCreationForm django.contrib.auth.forms, and you might want to consider
at least subclassing it so you can make use of some of its features (like
clean_username).
On Sun, Sep 8, 2013 at 11:41 AM, Anil Jangity wrote:
> class
class SignupForm(forms.ModelForm):
class Meta:
model = User
fields = ["username", "mail", "password"]
def clean_password(self):
password = self.cleaned_data.get("password")
return password
def save(self, commit=True):
user = super(SignupFor
Can you post your entire SignupForm class? I think a bit more context will
help me diagnose.
On Sun, Sep 8, 2013 at 11:27 AM, Anil Jangity wrote:
> I tried that too earlier.
>
> I added these to the SignupForm class:
>
> def clean_password(self):
> password = self.cleaned_data.get("
I tried that too earlier.
I added these to the SignupForm class:
def clean_password(self):
password = self.cleaned_data.get("password")
return password
def save(self, commit=True):
user = super(SignupForm, self).save(commit=False)
user.set_password(self.cl
You need to run the password through the 'set_password' method of the User
class to hash it. See:
https://docs.djangoproject.com/en/1.0/topics/auth/#django.contrib.auth.models.User.set_password
Hope this helps,
JDB
On Sun, Sep 8, 2013 at 11:02 AM, Anil Jangity wrote:
> New to Django.
> When I
New to Django.
When I submit a signup form with this, the password is human readable in the
database. It seems like it should be hashed?
Looking at some Google pages, it seems I need to subclass UserCreationForm.
I tried that instead of forms.ModelForm and now it complains my form doesn't
have
9 matches
Mail list logo