#27377: Clarify that prepopulated_fields doesn't work with OneToOneField
-------------------------------------+-------------------------------------
     Reporter:  Malik A. Rumi        |                    Owner:  Sudheesh
         Type:                       |  Singanamalla
  Cleanup/optimization               |                   Status:  assigned
    Component:  Documentation        |                  Version:  1.10
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
  prepopulated_fields, admin.py      |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sudheesh Singanamalla):

 * owner:  nobody => Sudheesh Singanamalla
 * status:  new => assigned


Comment:

 As far as what I understand from the discussion so far and the
 description, the fact that `prepopulated_fields` doesn't accept `OneToOne`
 fields needs to be explicitly mentioned in the documentation as well as an
 update to the following line
 
https://github.com/django/django/blob/f734e2d4b2fc4391a4d097b80357724815c1d414/django/contrib/admin/checks.py#L402
 mentioning
 {{{
      else:
             if isinstance(field, (models.DateTimeField, models.ForeignKey,
 models.ManyToManyField)):
                 return [
                     checks.Error(
                         "The value of '%s' refers to '%s', which must not
 be a DateTimeField, "
                         "a ForeignKey, a OneToOneField or a
 ManyToManyField." % (label, field_name),
                         obj=obj.__class__,
                         id='admin.E028',
                     )
                 ]
             else:
                 return []
 }}}

 Would this solve the issue ?

--
Ticket URL: <https://code.djangoproject.com/ticket/27377#comment:3>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.44fa545ac911f0e34a5e60617e4218a1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to