Loading docs/topics/forms/media.txt +32 −32 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -214,11 +214,11 @@ your site was ``'http://uploads.example.com/'`` and :setting:`STATIC_URL` was ``None``:: >>> class CalendarWidget(forms.TextInput): class Media: css = { 'all': ('/css/pretty.css',), } js = ('animations.js', 'http://othersite.com/actions.js') ... class Media: ... css = { ... 'all': ('/css/pretty.css',), ... } ... js = ('animations.js', 'http://othersite.com/actions.js') >>> w = CalendarWidget() >>> print w.media Loading Loading @@ -270,15 +270,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() Loading @@ -301,8 +301,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 Loading @@ -315,13 +315,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 Loading docs/topics/i18n/internationalization.txt +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ preceding the string, e.g.:: This also works in templates with the :ttag:`comment` tag: .. code-block:: django+html .. code-block:: html+django {% comment %}Translators: This is a text of the base template {% endcomment %} Loading Loading
docs/topics/forms/media.txt +32 −32 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -214,11 +214,11 @@ your site was ``'http://uploads.example.com/'`` and :setting:`STATIC_URL` was ``None``:: >>> class CalendarWidget(forms.TextInput): class Media: css = { 'all': ('/css/pretty.css',), } js = ('animations.js', 'http://othersite.com/actions.js') ... class Media: ... css = { ... 'all': ('/css/pretty.css',), ... } ... js = ('animations.js', 'http://othersite.com/actions.js') >>> w = CalendarWidget() >>> print w.media Loading Loading @@ -270,15 +270,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() Loading @@ -301,8 +301,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 Loading @@ -315,13 +315,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 Loading
docs/topics/i18n/internationalization.txt +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ preceding the string, e.g.:: This also works in templates with the :ttag:`comment` tag: .. code-block:: django+html .. code-block:: html+django {% comment %}Translators: This is a text of the base template {% endcomment %} Loading