#16156: Django overrides user-defined "User" model with its own
-----------------------------------------+------------------------------
               Reporter:  dloewenherz@…  |          Owner:  nobody
                   Type:  Bug            |         Status:  closed
              Milestone:                 |      Component:  contrib.auth
                Version:  1.3            |       Severity:  Normal
             Resolution:  invalid        |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
-----------------------------------------+------------------------------
Changes (by kmtracey):

 * status:  new => closed
 * needs_docs:   => 0
 * resolution:   => invalid
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 I'd guess you are importing Django's User somewhere before you specify the
 model `User` in the meta class for your !RegistrationForm. I do not see
 what you are describing, using your model, and avoiding any import of User
 from `django.contrib.auth.models':

 {{{
 >>> from ttt.models import User
 >>> import datetime
 >>> User.objects.create(email="x...@xyz.com", password="uhoh",
 birthday=datetime.date.today(), gender=True)
 <User: User object>
 >>> u = User.objects.all()[0]
 >>> u
 <User: User object>
 >>> u.email
 u'x...@xyz.com'
 >>> from django import forms
 >>> class RegistrationForm(forms.ModelForm):
 ...     class Meta():
 ...       model = User
 ...       fields = ['email', 'password']
 ...       widgets = {
 ...               'email': forms.TextInput(attrs={'autocomplete': 'off'}),
 ...               'password': forms.PasswordInput(attrs={'autocomplete':
 'off'})}
 ...
 >>> rf = RegistrationForm(instance=u)
 >>> rf.as_p()
 u'<p><label for="id_email">Email:</label> <input name="email"
 value="x...@xyz.com" autocomplete="off" maxlength="75" type="text"
 id="id_email" /></p>\n<p><label for="id_password">Password:</label> <input
 autocomplete="off" id="id_password" type="password" name="password"
 maxlength="51" /></p>'
 >>>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16156#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to