1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

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
This commit is contained in:
Brian Rosner
2008-07-18 23:54:34 +00:00
parent dc375fb0f3
commit a19ed8aea3
121 changed files with 8050 additions and 2680 deletions

View File

@@ -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
<link href="/some/form/css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="/some/form/javascript"></script>
"""}