From a19ed8aea395e8e07164ff7d85bd7dff2f24edca Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Fri, 18 Jul 2008 23:54:34 +0000 Subject: Merged the newforms-admin branch into trunk. This is a backward incompatible change. The admin contrib app has been refactored. The newforms module has several improvements including FormSets and Media definitions. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7967 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/model_forms/models.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/modeltests/model_forms') diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py index e8598bd68f..6838f11d4e 100644 --- a/tests/modeltests/model_forms/models.py +++ b/tests/modeltests/model_forms/models.py @@ -992,4 +992,22 @@ True u'...test3.png' >>> instance.delete() +# Media on a ModelForm ######################################################## + +# Similar to a regular Form class you can define custom media to be used on +# the ModelForm. + +>>> class ModelFormWithMedia(ModelForm): +... class Media: +... js = ('/some/form/javascript',) +... css = { +... 'all': ('/some/form/css',) +... } +... class Meta: +... model = PhoneNumber +>>> f = ModelFormWithMedia() +>>> print f.media + + + """} -- cgit v1.3