I have been using django.contrib.auth for some time now. I have been
creating users and assigning them to groups successfully.

I do something like this: -

                user = User.objects.create_user
(username=form.cleaned_data['username'],
 
password=form.cleaned_data['password'],
                                                email=form.cleaned_data
['email'])
                user.is_staff=True
                user.first_name=form.cleaned_data['first_name']
                user.last_name=form.cleaned_data['last_name']
                group = Group.objects.get(name='B')
                user.groups.add(group)
                user.save()

However, I just realized that I have never done

                from django.contrib.auth.models import User, Group

I don't understand why my code works without the proper import
statements!?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.


Reply via email to