After learning JQuery in a couple of hours I've done just that!! I presume it's best to add simple functionality like this rather than use templates?
Cheers Niall On 4 Jan 2009, at 16:33, Daniel Roseman wrote: > > On Jan 4, 10:18 am, Niall Mccormack <mailingli...@itsallmememe.com> > wrote: >> Hi there, >> >> I'm trying to override the edit_inline_stacked template so I can >> dynamically add in extra inline data via javascript - similar >> tohttp://www.arnebrodowski.de/blog/507-Add-and-remove-Django-Admin-Inli >> ... >> >> I can override the change_form admin template, but can't seem to use/ >> override the following line to hook into the inline objects loop >> {% for related_object in inline_related_objects %}{% edit_inline >> related_object %}{% endfor %} >> >> If I directly reference a template from the inline, duplicating the >> edit_inline_stacked.html template, I get 'Invalid Block Tag' errors >> for the following two lines >> {% field_widget bound_field %} >> {% admin_field_line bound_field %} >> >> I'm pretty new to Django, but am enjoying it, however I would like to >> get this working for my own site. >> >> If anyone has any advice, or any other methods of adding/removing >> data >> dynamically from inlines then I'd really appreciate it! >> >> Cheers >> Niall > > Rather than override the template just to add some javascript, it's > probably easier to use a custom form for the inline model, and add a > Media class referencing the URL of your javascript file. > > Something like: > > class CustomInlineForm(forms.ModelForm): > class Meta: > model = MyInlineModel > > class Media: > js = ('/path/to/my/javascript.js',) > > class CustomInlineAdmin(admin.TabularInline) > form = CustomInlineForm > > class CustomMasterAdmin(admin.ModelAdmin): > inlines = [CustomInlineAdmin] > > -- > DR. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---