mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-19 22:31:04 +00:00
Using own modelform_factory to produce forms that are using floppyforms widgets. That allows better customization in the frontend.
This commit is contained in:
parent
188c12d647
commit
984b6fb8d4
1 changed files with 5 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ import extra_views
|
|||
from djadmin2 import apiviews
|
||||
from djadmin2 import constants
|
||||
from djadmin2 import views
|
||||
from djadmin2.forms import modelform_factory
|
||||
|
||||
|
||||
class BaseAdmin2(object):
|
||||
|
|
@ -167,9 +168,12 @@ class ModelAdmin2(BaseAdmin2):
|
|||
|
||||
def get_update_kwargs(self):
|
||||
kwargs = self.get_default_view_kwargs()
|
||||
form_class = self.update_form_class if self.update_form_class else self.form_class
|
||||
if form_class is None:
|
||||
form_class = modelform_factory(self.model)
|
||||
kwargs.update({
|
||||
'inlines': self.inlines,
|
||||
'form_class': self.update_form_class if self.update_form_class else self.form_class,
|
||||
'form_class': form_class,
|
||||
})
|
||||
return kwargs
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue