Author: Alex
Date: 2010-11-17 10:11:17 -0600 (Wed, 17 Nov 2010)
New Revision: 14599
Modified:
django/branches/releases/1.2.X/docs/topics/forms/media.txt
Log:
[1.2.X] Corrected some syntax issues in the docs. Backport of [14598].
Modified: django/branches/releases/1.2.X/docs/topics/forms/media.txt
===================================================================
--- django/branches/releases/1.2.X/docs/topics/forms/media.txt 2010-11-17
16:08:28 UTC (rev 14598)
+++ django/branches/releases/1.2.X/docs/topics/forms/media.txt 2010-11-17
16:11:17 UTC (rev 14599)
@@ -132,11 +132,11 @@
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 @@
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 @@
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 @@
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,14 +292,14 @@
layout -- simply add a media declaration to 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)
+ ...
+ ... class Media:
+ ... css = {
+ ... 'all': ('layout.css',)
+ ... }
- class Media:
- css = {
- 'all': ('layout.css',)
- }
-
>>> f = ContactForm()
>>> f.media
<link href="http://media.example.com/pretty.css" type="text/css"
media="all" rel="stylesheet" />
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.