Opened 14 years ago
Closed 14 years ago
#14949 closed (duplicate)
Admin inlines not saving on "Save As New"
Reported by: | Paul Bailey | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have an admin class that has 3 inlines (code below). When using the "Save as New" button the inlines are not saved under certain circumstances. The conditions that cause the problem are as follows. Usually one the inlines has no data which is expected. If you enter data for an inline that was not previously used then data is not saved on "Save as new". If there was data previously entered and you just change that inline then everything works fine. The data in the previously unused inlines is also not validated because you can enter bad data and no error messages are returned. So the data is just ignored altogether for some reason. Will attach some screen shots shortly.
class EPAdmin (admin.TabularInline): model = hp_models.EditorsPick extra = 5 max_num = 5 raw_id_fields = ('event', 'clist', 'news', 'place', 'best') can_delete = False readonly_fields = ('crop',) fieldsets = ( (None, { 'fields': ('label', 'event', 'clist', 'news', 'place', 'best', 'iorder', 'crop') }),) class ThreadAdmin (admin.TabularInline): model = hp_models.Thread extra = 5 max_num = 7 raw_id_fields = ('event', 'clist', 'news', 'place', 'best') readonly_fields = ('crop',) fieldsets = ( (None, { 'fields': ('event', 'clist', 'news', 'place', 'best', 'iorder', 'crop') }),) class ThreadPlusAdmin (admin.TabularInline): model = hp_models.ThreadPlus extra = 2 max_num = 2 raw_id_fields = ('event', 'clist', 'news', 'place', 'best') can_delete = False fieldsets = ( (None, { 'fields': ('event', 'clist', 'news', 'place', 'best', 'iorder') }),) class EPModuleAdmin (admin.ModelAdmin): inlines = (EPAdmin, ThreadAdmin, ThreadPlusAdmin) list_filter = ('publish', 'modtype') list_display = ('publish', 'modtype', 'clone', 'preview') save_as = True raw_id_fields = ('thread_photo',) readonly_fields = ('thread_crop',) class Media: js = ("javascript/jquery/jquery-1.3.2.js", "rd/js/admin/genericmodule.js",)
Attachments (3)
Change History (4)
by , 14 years ago
Attachment: | 14949_1_initial.jpg added |
---|
by , 14 years ago
Attachment: | 14949_3_after_save_as_new.jpg added |
---|
Successful info saved in green and missing data in red and green
comment:1 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Thank you for the report. I'm pretty sure this is a dupe of #14938.
Initial Object