diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt
index 4399e75..615dd71 100644
a
|
b
|
through this property::
|
65 | 65 | |
66 | 66 | >>> w = CalendarWidget() |
67 | 67 | >>> print(w.media) |
68 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
69 | | <script type="text/javascript" src="http://media.example.com/animations.js"></script> |
70 | | <script type="text/javascript" src="http://media.example.com/actions.js"></script> |
| 68 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 69 | <script type="text/javascript" src="http://static.example.com/animations.js"></script> |
| 70 | <script type="text/javascript" src="http://static.example.com/actions.js"></script> |
71 | 71 | |
72 | 72 | Here's a list of all possible ``Media`` options. There are no required options. |
73 | 73 | |
… |
… |
requirements::
|
110 | 110 | |
111 | 111 | If this last CSS definition were to be rendered, it would become the following HTML:: |
112 | 112 | |
113 | | <link href="http://media.example.com/pretty.css" type="text/css" media="screen" rel="stylesheet" /> |
114 | | <link href="http://media.example.com/lo_res.css" type="text/css" media="tv,projector" rel="stylesheet" /> |
115 | | <link href="http://media.example.com/newspaper.css" type="text/css" media="print" rel="stylesheet" /> |
| 113 | <link href="http://static.example.com/pretty.css" type="text/css" media="screen" rel="stylesheet" /> |
| 114 | <link href="http://static.example.com/lo_res.css" type="text/css" media="tv,projector" rel="stylesheet" /> |
| 115 | <link href="http://static.example.com/newspaper.css" type="text/css" media="print" rel="stylesheet" /> |
116 | 116 | |
117 | 117 | ``js`` |
118 | 118 | ~~~~~~ |
… |
… |
basic Calendar widget from the example above::
|
140 | 140 | |
141 | 141 | >>> w = FancyCalendarWidget() |
142 | 142 | >>> print(w.media) |
143 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
144 | | <link href="http://media.example.com/fancy.css" type="text/css" media="all" rel="stylesheet" /> |
145 | | <script type="text/javascript" src="http://media.example.com/animations.js"></script> |
146 | | <script type="text/javascript" src="http://media.example.com/actions.js"></script> |
147 | | <script type="text/javascript" src="http://media.example.com/whizbang.js"></script> |
| 143 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 144 | <link href="http://static.example.com/fancy.css" type="text/css" media="all" rel="stylesheet" /> |
| 145 | <script type="text/javascript" src="http://static.example.com/animations.js"></script> |
| 146 | <script type="text/javascript" src="http://static.example.com/actions.js"></script> |
| 147 | <script type="text/javascript" src="http://static.example.com/whizbang.js"></script> |
148 | 148 | |
149 | 149 | The FancyCalendar widget inherits all the media from it's parent widget. If |
150 | 150 | you don't want media to be inherited in this way, add an ``extend=False`` |
… |
… |
declaration to the media declaration::
|
160 | 160 | |
161 | 161 | >>> w = FancyCalendarWidget() |
162 | 162 | >>> print(w.media) |
163 | | <link href="http://media.example.com/fancy.css" type="text/css" media="all" rel="stylesheet" /> |
164 | | <script type="text/javascript" src="http://media.example.com/whizbang.js"></script> |
| 163 | <link href="http://static.example.com/fancy.css" type="text/css" media="all" rel="stylesheet" /> |
| 164 | <script type="text/javascript" src="http://static.example.com/whizbang.js"></script> |
165 | 165 | |
166 | 166 | If you require even more control over media inheritance, define your media |
167 | 167 | using a `dynamic property`_. Dynamic properties give you complete control over |
… |
… |
to filter out a medium of interest. For example::
|
253 | 253 | |
254 | 254 | >>> w = CalendarWidget() |
255 | 255 | >>> print(w.media) |
256 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
257 | | <script type="text/javascript" src="http://media.example.com/animations.js"></script> |
258 | | <script type="text/javascript" src="http://media.example.com/actions.js"></script> |
| 256 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 257 | <script type="text/javascript" src="http://static.example.com/animations.js"></script> |
| 258 | <script type="text/javascript" src="http://static.example.com/actions.js"></script> |
259 | 259 | |
260 | 260 | >>> print(w.media)['css'] |
261 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 261 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
262 | 262 | |
263 | 263 | When you use the subscript operator, the value that is returned is a new |
264 | 264 | Media object -- but one that only contains the media of interest. |
… |
… |
the resulting Media object contains the union of the media from both files::
|
283 | 283 | >>> w1 = CalendarWidget() |
284 | 284 | >>> w2 = OtherWidget() |
285 | 285 | >>> print(w1.media + w2.media) |
286 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
287 | | <script type="text/javascript" src="http://media.example.com/animations.js"></script> |
288 | | <script type="text/javascript" src="http://media.example.com/actions.js"></script> |
289 | | <script type="text/javascript" src="http://media.example.com/whizbang.js"></script> |
| 286 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 287 | <script type="text/javascript" src="http://static.example.com/animations.js"></script> |
| 288 | <script type="text/javascript" src="http://static.example.com/actions.js"></script> |
| 289 | <script type="text/javascript" src="http://static.example.com/whizbang.js"></script> |
290 | 290 | |
291 | 291 | Media on Forms |
292 | 292 | -------------- |
… |
… |
of adding the media definitions for all widgets that are part of the form::
|
306 | 306 | |
307 | 307 | >>> f = ContactForm() |
308 | 308 | >>> f.media |
309 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
310 | | <script type="text/javascript" src="http://media.example.com/animations.js"></script> |
311 | | <script type="text/javascript" src="http://media.example.com/actions.js"></script> |
312 | | <script type="text/javascript" src="http://media.example.com/whizbang.js"></script> |
| 309 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 310 | <script type="text/javascript" src="http://static.example.com/animations.js"></script> |
| 311 | <script type="text/javascript" src="http://static.example.com/actions.js"></script> |
| 312 | <script type="text/javascript" src="http://static.example.com/whizbang.js"></script> |
313 | 313 | |
314 | 314 | If you want to associate additional media with a form -- for example, CSS for form |
315 | 315 | layout -- simply add a media declaration to the form:: |
… |
… |
layout -- simply add a media declaration to the form::
|
325 | 325 | |
326 | 326 | >>> f = ContactForm() |
327 | 327 | >>> f.media |
328 | | <link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
329 | | <link href="http://media.example.com/layout.css" type="text/css" media="all" rel="stylesheet" /> |
330 | | <script type="text/javascript" src="http://media.example.com/animations.js"></script> |
331 | | <script type="text/javascript" src="http://media.example.com/actions.js"></script> |
332 | | <script type="text/javascript" src="http://media.example.com/whizbang.js"></script> |
| 328 | <link href="http://static.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /> |
| 329 | <link href="http://static.example.com/layout.css" type="text/css" media="all" rel="stylesheet" /> |
| 330 | <script type="text/javascript" src="http://static.example.com/animations.js"></script> |
| 331 | <script type="text/javascript" src="http://static.example.com/actions.js"></script> |
| 332 | <script type="text/javascript" src="http://static.example.com/whizbang.js"></script> |