Hi, I had my fun when I tried to add more inline stuff to a Admin form, and I ended up doing thiskind of stuff:
https://janimagik.wordpress.com/2015/05/05/django-admin-and-inline-chaining/ I guess problem is how Django admin uses metaclass to do some magic behind the scenes. On Thu, 2 Jul 2015 03:30:59 -0700 (PDT) kny...@knyg.ht wrote: > I think it could be - if not the exact same issue - one that would be fixed > by the same patch. My specific use case is something like this: > > class MyUserAdmin(UserAdmin): > def get_fieldsets(self, request, obj=None): > fieldsets = super().get_fieldsets(request, obj) > fieldsets[0][1]['fields'] = list(fieldsets[0][1]['fields']) > fieldsets[0][1]['fields'].append('category') > > which is already pretty ugly, but needs uglifying further: > > class MyUserAdmin(UserAdmin): > def get_fieldsets(self, request, obj=None): > fieldsets = super().get_fieldsets(request, obj) > fieldsets[0][1]['fields'] = list(fieldsets[0][1]['fields']) > > if 'category' not in fieldsets[0][1]['fields'][-1]: > fieldsets[0][1]['fields'].append('category') > > Logically, they could be the same issue, but I haven't dug in to see if > this is the case. Is it really the case that the overhead of deepcopy() is > too much here? > > > On Thursday, July 2, 2015 at 2:33:24 AM UTC+1, Tim Graham wrote: > > > > Could it be https://code.djangoproject.com/ticket/22828 ? > > > > On Wednesday, July 1, 2015 at 5:32:48 PM UTC-4, kny...@knyg.ht wrote: > >> > >> Hello all, > >> > >> So, I was talking to kezabelle on IRC some months back about a problem I > >> was having, and finally remembered to post something. > >> > >> If I inherit from an admin class, and override something like > >> get_fields(), I was getting back duplicates of fields if I used super() to > >> get the existing fields and add to them. And if I reload the page, I would > >> get more and more fields until I restarted the dev server. Something about > >> ModelAdmin being one instance per process. It seems very counter-intuitive > >> to me, and I was wondering if anyone was considering fixing this? I'm > >> under > >> the impression it might be some work to do. > >> > >> Cheers, > >> Tom > >> > > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at http://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/bd375dce-428f-4ca3-a2bc-2533f47134db%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Jani Tiainen -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/20150702134617.515b79d7%40jns42-l.w2k.keypro.fi. For more options, visit https://groups.google.com/d/optout.