Changes between Version 12 and Version 13 of NewformsHOWTO


Ignore:
Timestamp:
02/18/2008 01:39:52 PM (7 years ago)
Author:
mrts
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewformsHOWTO

    v12 v13  
    435435}}}
    436436
    437 == Q: How do I add custom javascript? ==
     437== Q: How do I add custom !JavaScript/CSS? ==
    438438
    439439Override `form_add()` and `form_change()` in ModelAdmin.
     
    445445    inlines = (MyOtherModelInline,)
    446446    def form_add(self, req):
    447         class _AddForm(forms.Form):
    448             class Media:
     447        class _AddForm(forms.BaseForm):
     448            media = forms.Media(
    449449                js = ['/site_media/js/tiny_mce/tiny_mce.js',
    450                         '/site_media/js/add_editor.js']
     450                        '/site_media/js/add_editor.js'])
    451451        if self.declared_fieldsets:
    452452            fields = flatten_fieldsets(self.declared_fieldsets)
    453453        else:
    454454            fields = None
    455         return forms.form_for_model(self.model, form=_AddForm, fields=fields,
    456                            formfield_callback=self.formfield_for_dbfield)
     455        return forms.form_for_model(self.model, form=_AddForm, fields=fields, formfield_callback=self.formfield_for_dbfield)
    457456}}}
    458457
Back to Top