#14949: Admin inlines not saving on "Save As New"
----------------------------------+-----------------------------------------
 Reporter:  pizzapanther          |       Owner:  nobody    
   Status:  new                   |   Milestone:            
Component:  django.contrib.admin  |     Version:  1.2       
 Keywords:                        |       Stage:  Unreviewed
Has_patch:  0                     |  
----------------------------------+-----------------------------------------
 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",)

 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14949>
Django <http://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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to