#27231: Initialize forms in ModelAdmin like View (i.e. add get_form_kwargs to contrib.admin) -------------------------------+-------------------------------------- Reporter: Thomas Hauk | Owner: nobody Type: New feature | Status: closed Component: contrib.admin | Version: 1.10 Severity: Normal | Resolution: wontfix 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 Cody Hiar): Hey Thomas - I had a very similar situation I ended up using django's curry for clean solution: {{{ from django.utils.functional import curry def get_form(self, form_class=None): """ Returns an instance of the form to be used in this view. """ if form_class is None: form_class = self.get_form_class() return curry(form_class, **self.get_form_kwargs()) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/27231#comment:10> 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/074.33a7ba2bf86fdb18ca4513f9470119cd%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.