On 2/3/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > Regarding "edit inline," a couple of decisions need to be made. Ticket > #2248 (http://code.djangoproject.com/ticket/2248) has an interesting > suggestion: you define the inline stuff within the admin class. I'll > copy and paste from that ticket:
+1 to the general idea. I've always been concerned about the idea of having form definitions in the field. > from django.contrib.admin import TabularInline, StackedInline > > # ... > > class Admin: > inlines = ( > TabularInline('Child', min=3, max=20, extra=3, > fields=('name', 'age')), > StackedInline('Job', min=1, max=3, > fields=('company', 'salary')), > ) > > This infastructure would let you create your own inline types by > implementing an Inline subclass. This is possibly nitpicking on a quick-and-dirty example - but shouldn't the Inline definitions be tied to a m2m/m2o field name, rather than the model name? class Admin: inlines = { 'children': TabularInline(min=3, max=20, extra=3, fields=('name', 'age')), 'jobs': StackedInline(min=1, max=3, fields=('company', 'salary')), } That way there are no difficulties if there are multiple m2m realtions on the same model. > What sort of hooks would an Inline class need? And are there any > thoughts or other ideas/proposals while we're focusing on this? This is possibly what you already have in mind - but Is there an intersection here between inline fields and recursive form definitions? form = form_for_model(Person, fields=('name','age'), inlines={ 'children': TabularInline(... }) The *Inline classes need not just be data containers - they could contain all the rendering information for handling their own display, and the display of the subforms for each related object - and if this is the case, they can be used by end users on their own forms. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---