On Mon, 2009-03-09 at 01:06 -0700, myst3rious wrote: > > > If you're setting all these things in the User object, then reverse the > > logic slightly: > > > > new_user = User.objects.create(username=username, > > email=email, > > is_active=True, > > first_name=firstname, > > last_name=lastname) > > new_user.set_password(password) > > new_user.save() # needed because set_password() doesn't call > > save() > > > > > new_user.save() > > ok, this is almost same as my code, well, I supplied the password in > create() method. I can use the set_password, though.
The only reason I turned it around was if you're thinking the length was a problem. You can collapse the first 5 lines of the above, so it becomes a three line function. Your original version had a separate line for assigning is_active and first- and last-names. I was only wanting to point out that you can use the normal Model.objects.create(...) method if you're supplying more information than create_user() takes (which is just for simple stuff). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---