diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2010-11-17 16:11:17 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2010-11-17 16:11:17 +0000 |
| commit | 6469eec71d9d82d8be2ac62a128273426d78ab5b (patch) | |
| tree | 95a6aeea678ae1d34e1b7e7cf551035bf4e829d4 | |
| parent | f58d17db7495ce56acb9029ae4ebeab00cba085a (diff) | |
[1.2.X] Corrected some syntax issues in the docs. Backport of [14598].
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14599 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | docs/topics/forms/media.txt | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt index 9372c0e6a8..fe70894680 100644 --- a/docs/topics/forms/media.txt +++ b/docs/topics/forms/media.txt @@ -132,11 +132,11 @@ parent defines its media requirements. For example, if we were to extend our basic Calendar widget from the example above:: >>> class FancyCalendarWidget(CalendarWidget): - class Media: - css = { - 'all': ('fancy.css',) - } - js = ('whizbang.js',) + ... class Media: + ... css = { + ... 'all': ('fancy.css',) + ... } + ... js = ('whizbang.js',) >>> w = FancyCalendarWidget() >>> print w.media @@ -151,12 +151,12 @@ you don't want media to be inherited in this way, add an ``extend=False`` declaration to the media declaration:: >>> class FancyCalendarWidget(CalendarWidget): - class Media: - extend = False - css = { - 'all': ('fancy.css',) - } - js = ('whizbang.js',) + ... class Media: + ... extend = False + ... css = { + ... 'all': ('fancy.css',) + ... } + ... js = ('whizbang.js',) >>> w = FancyCalendarWidget() >>> print w.media @@ -247,15 +247,15 @@ Media objects can also be added together. When two media objects are added, the resulting Media object contains the union of the media from both files:: >>> class CalendarWidget(forms.TextInput): - class Media: - css = { - 'all': ('pretty.css',) - } - js = ('animations.js', 'actions.js') + ... class Media: + ... css = { + ... 'all': ('pretty.css',) + ... } + ... js = ('animations.js', 'actions.js') >>> class OtherWidget(forms.TextInput): - class Media: - js = ('whizbang.js',) + ... class Media: + ... js = ('whizbang.js',) >>> w1 = CalendarWidget() >>> w2 = OtherWidget() @@ -278,8 +278,8 @@ have a media property. The default value for this property is the result of adding the media definitions for all widgets that are part of the form:: >>> class ContactForm(forms.Form): - date = DateField(widget=CalendarWidget) - name = CharField(max_length=40, widget=OtherWidget) + ... date = DateField(widget=CalendarWidget) + ... name = CharField(max_length=40, widget=OtherWidget) >>> f = ContactForm() >>> f.media @@ -292,13 +292,13 @@ If you want to associate additional media with a form -- for example, CSS for fo layout -- simply add a media declaration to the form:: >>> class ContactForm(forms.Form): - date = DateField(widget=CalendarWidget) - name = CharField(max_length=40, widget=OtherWidget) - - class Media: - css = { - 'all': ('layout.css',) - } + ... date = DateField(widget=CalendarWidget) + ... name = CharField(max_length=40, widget=OtherWidget) + ... + ... class Media: + ... css = { + ... 'all': ('layout.css',) + ... } >>> f = ContactForm() >>> f.media |
