#27377: Prepopulated Fields in Django Admin -------------------------------+------------------------------------------- Reporter: Malik A. Rumi | Owner: nobody Type: Bug | Status: new Component: Documentation | Version: 1.10 Severity: Normal | Keywords: prepopulated_fields, admin.py Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+------------------------------------------- I don't know if this should be a bug report or a feature request.
I know that some variation on this question has been asked and answered many times on Stack Overflow. Usually, however, it is about using a foreign key. This is not my question. "prepopulated_fields doesn’t accept DateTimeField, ForeignKey, nor ManyToManyField fields." https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.prepopulated_fields By implication, the docs are saying OneToOne fields are ok. This makes even more sense where the inherited models are a concrete subclass of a concrete base and we are really talking about a single object. For example, a Place can be a Restaurant, and a Restaurant can have a closed off, separate Bar where kids are not allowed. https://docs.djangoproject.com/en/1.10/topics/db/models/#one-to-one- relationships However, admin.py is looking for a string to concatenate, not a filtered queryset leading to a related field or object. Furthermore, it expects that string to match the name of an existing field on the instant model, not some other model, even if they are the same object. How, then, can one use a OneToOne field or model in admin.py? I posted this to SO myself, and got ZERO responses. http://stackoverflow.com/questions/39778945/django- prepopulated-fields-inheritance Yes, I know about model-utils and polymorphic. But if I am reading the docs correctly, this should be possible without resort to those tools. Besides, both are aimed primarily at queries, and say nothing directly about this specific issue with prepopulated fields in admin.py. Please advise. Thanks. -- Ticket URL: <https://code.djangoproject.com/ticket/27377> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.e0ef9383d1ed71ff8207a30087a225cf%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.