django-nested-inline
django-nested-inline copied to clipboard
`ModelAdmin.save_as = True` is broken
The ModelAdmin class has a property called 'save_as', which if set to True, will include a "Save as new" button on the admin change view. When the property is added to the test project admin configuration...
class TopLevelAdmin(NestedModelAdmin):
model = TopLevel
inlines = [LevelOneInline]
save_as = True
Selecting "save as new" causes an IndexError.
The default behavior for vanilla inlines attached to ModelAdmin classes with "save_as=True" seems to be that all the inlines are re-saved as new instances having all the same properties except the FK is updated to the new value.
For me it's an attribute error in nested_inline.admin.NestedModelAdmin.change_view. Looks like a typo: opts.module_name instead of opts.model_name.
I am noticing the save as = true is unable to populated the nested inline class. any attribute which i need to set to get it working?
I have the same issue: 'Options' object has no attribute 'module_name'
other than hacking the installed code (if it's just a case of a typo as referenced above) is there a work-around? (I inherited the project that's using dj-nested-inline, and would prefer NOT having to do a lot of coding to just allow a model admin to have save_as=True (budget, etc. issues).)
It looks like opts.module_name was renamed opts.model_name.
https://docs.djangoproject.com/en/1.8/internals/deprecation/
If you want to make a PR I will merge and update pypi. If not I will try to do it in the next few days.