#27157: AdminForm model_admin cannot be None -------------------------------+-------------------------------------- Reporter: tpazderka | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 1.10 Severity: Normal | Resolution: Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+--------------------------------------
Comment (by tpazderka): This is just a stub as our class is not based on `BaseFormset` but rather reimplements its methods... I am not sure if this is sufficient. If not, I will try to write more complete example. {{{ #!python class ContactFormset(BaseFormset): @property def forms(self): """ Iterates through forms and returns them wrapped by `AdminForm`. """ for form, datatype in zip(self._forms, self.get_types()): yield AdminForm(form, (self.get_fieldset(datatype), ), {}, self.get_readonly_fields(datatype)) }}} The last line has to be replaced by: {{{ #!python yield AdminForm(form, (self.get_fieldset(datatype), ), {}, self.get_readonly_fields(datatype), model_admin=ModelAdmin(MojeidUser, AdminSite)) }}} in order to work in django 1.9 and later. -- Ticket URL: <https://code.djangoproject.com/ticket/27157#comment:2> 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/067.62da634242148f9de83e421204b7d539%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.