On Nov 17, 9:50 am, Jyrki Pulliainen <jyrki.pulliai...@gmail.com> wrote: > Hi all, > > I discovered yesterday that ModelAdmin does not display fields set in > the __init__ of the custom form. This is due to > django.contrib.admin.ModelAdmin.get_fieldsets only looking at the > base_field variable of the form *class' instead of the form instance. > This can be circumvented with a factory or by using a metaclass. I > implemented a metaclass version of this just out of > curiosity:https://gist.github.com/1370436 > > My question is that is this intended behavior or is the problem > outside the scope of the django.contrib.admin? If it it is I'm fine > with that, though I find it a bit confusing that the dynamic form > field creation tips do not apply to forms used in admin. If it's not, > I'm more than happy to look into the issue deeper and try to work a > patch. However, the patch might be quite intrusive and change a lot of > the internal behavior of the django.contrib.admin. > > Looking forward on your feedback!
As nobody else has responded, here is my take on this. These sort of things have a good chance to get included if the patch is simple. If, as you say, the patch is intrusive, then you will have harder time to get a reviewer & committer for you patch. If it makes the admin code more complicated, you will also need to show why this feature warrants the added complexity. It is not entirely clear to me why admin should support dynamic forms. So, first things first: can you give some use cases where this would be useful, and where you can't use the current admin hooks to accomplish the use case. The worst thing that can happen is that you create a big patch, but it turns out the approach is unworkable. So, second step would be to make a plan of what needs changing and why. Or you can just write the patch and see what happens. That risks wasting some effort if you took the wrong approach. But on the other hand that is pretty effective way to learn the code base... And in some cases writing the patch directly needs about the same amount of work as writing the plan. Unfortunately I do not know the admin & forms parts of the code well enough to give any advice on the correct approach. - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.