Opened 13 years ago

Closed 13 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)

14949_1_initial.jpg (184.2 KB ) - added by Paul Bailey 13 years ago.
Initial Object
14949_2_changes.jpg (195.9 KB ) - added by Paul Bailey 13 years ago.
Changes that were made highlighted in red
14949_3_after_save_as_new.jpg (195.1 KB ) - added by Paul Bailey 13 years ago.
Successful info saved in green and missing data in red and green

Download all attachments as: .zip

Change History (4)

by Paul Bailey, 13 years ago

Attachment: 14949_1_initial.jpg added

Initial Object

by Paul Bailey, 13 years ago

Attachment: 14949_2_changes.jpg added

Changes that were made highlighted in red

by Paul Bailey, 13 years ago

Successful info saved in green and missing data in red and green

comment:1 by Julien Phalip, 13 years ago

Resolution: duplicate
Status: newclosed

Thank you for the report. I'm pretty sure this is a dupe of #14938.

Note: See TracTickets for help on using tickets.
Back to Top