Changeset 775
- Timestamp:
- 10/04/05 14:34:43 (3 years ago)
- Files:
-
- django/branches/i18n/django/conf/admin_media/css/changelists.css (modified) (1 diff)
- django/branches/i18n/django/conf/global_settings.py (modified) (1 diff)
- django/branches/i18n/django/core/defaulttags.py (modified) (2 diffs)
- django/branches/i18n/django/core/management.py (modified) (2 diffs)
- django/branches/i18n/django/core/rss.py (modified) (4 diffs)
- django/branches/i18n/django/views/admin/main.py (modified) (1 diff)
- django/branches/i18n/django/views/generic/create_update.py (modified) (3 diffs)
- django/branches/i18n/django/views/generic/date_based.py (modified) (5 diffs)
- django/branches/i18n/django/views/generic/list_detail.py (modified) (2 diffs)
- django/branches/i18n/docs/db-api.txt (modified) (1 diff)
- django/branches/i18n/docs/model-api.txt (modified) (2 diffs)
- django/branches/i18n/docs/modpython.txt (modified) (1 diff)
- django/branches/i18n/docs/outputting_pdf.txt (copied) (copied from django/trunk/docs/outputting_pdf.txt)
- django/branches/i18n/docs/templates_python.txt (modified) (1 diff)
- django/branches/i18n/docs/templates.txt (modified) (1 diff)
- django/branches/i18n/docs/tutorial01.txt (modified) (4 diffs)
- django/branches/i18n/docs/tutorial03.txt (modified) (1 diff)
- django/branches/i18n/tests/othertests/templates.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/i18n/django/conf/admin_media/css/changelists.css
r154 r775 19 19 #changelist {position:relative; width:100%;} 20 20 #changelist table {width:100%;} 21 .change-list .filtered table { border-right:1px solid #ddd ; }21 .change-list .filtered table { border-right:1px solid #ddd, width:100%; } 22 22 .change-list .filtered {min-height:400px; _height:400px;} 23 23 .change-list .filtered {background:white url(../img/admin/changelist-bg.gif) top right repeat-y !important;} 24 .change-list .filtered table, .filtered.paginator, .filtered #toolbar, .filtered div.xfull {margin-right:160px !important; width:auto !important; }24 .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull {margin-right:160px !important; width:auto !important; } 25 25 .change-list .filtered table tbody th {padding-right:10px;} 26 26 #changelist .toplinks {border-bottom:1px solid #ccc !important;} django/branches/i18n/django/conf/global_settings.py
r768 r775 121 121 122 122 # Path to the "jing" executable -- needed to validate XMLFields 123 JING_PATH = "/usr/bin/j ng"123 JING_PATH = "/usr/bin/jing" 124 124 125 125 ############## django/branches/i18n/django/core/defaulttags.py
r757 r775 101 101 'counter0': i, 102 102 'counter': i+1, 103 # reverse counter iteration numbers 104 'revcounter': len_values - i, 105 'revcounter0': len_values - i - 1, 103 106 # boolean values designating first and last times through loop 104 107 'first': (i == 0), … … 472 475 ``forloop.counter`` The current iteration of the loop (1-indexed) 473 476 ``forloop.counter0`` The current iteration of the loop (0-indexed) 477 ``forloop.revcounter`` The number of iterations from the end of the 478 loop (1-indexed) 479 ``forloop.revcounter0`` The number of iterations from the end of the 480 loop (0-indexed) 474 481 ``forloop.first`` True if this is the first time through the loop 475 482 ``forloop.last`` True if this is the last time through the loop django/branches/i18n/django/core/management.py
r713 r775 157 157 def get_sql_initial_data(mod): 158 158 "Returns a list of the initial INSERT SQL statements for the given module." 159 from django.core import db 159 160 output = [] 160 161 app_label = mod._MODELS[0]._meta.app_label … … 163 164 for klass in mod._MODELS: 164 165 opts = klass._meta 166 165 167 # Add custom SQL, if it's available. 166 sql_file_name = os.path.join(app_dir, opts.module_name + '.sql') 167 if os.path.exists(sql_file_name): 168 fp = open(sql_file_name, 'r') 169 output.append(fp.read()) 170 fp.close() 168 sql_files = [os.path.join(app_dir, opts.module_name + '.' + db.DATABASE_ENGINE + '.sql'), 169 os.path.join(app_dir, opts.module_name + '.sql')] 170 for sql_file in sql_files: 171 if os.path.exists(sql_file): 172 fp = open(sql_file) 173 output.append(fp.read()) 174 fp.close() 175 171 176 # Content types. 172 177 output.append(_get_contenttype_insert(opts)) django/branches/i18n/django/core/rss.py
r3 r775 8 8 class FeedConfiguration: 9 9 def __init__(self, slug, title_cb, link_cb, description_cb, get_list_func_cb, get_list_kwargs, 10 param_func=None, param_kwargs_cb=None, get_list_kwargs_cb=None, 10 param_func=None, param_kwargs_cb=None, get_list_kwargs_cb=None, get_pubdate_cb=None, 11 11 enc_url=None, enc_length=None, enc_mime_type=None): 12 12 """ … … 29 29 get_list_kwargs_cb -- Function that takes the param and returns a 30 30 dictionary to use in addition to get_list_kwargs (if applicable). 31 32 get_pubdate_cb -- Function that takes the object and returns a datetime 33 to use as the publication date in the feed. 31 34 32 35 The three enc_* parameters are strings representing methods or … … 42 45 self.param_func, self.param_kwargs_cb = param_func, param_kwargs_cb 43 46 self.get_list_kwargs_cb = get_list_kwargs_cb 47 self.get_pubdate_cb = get_pubdate_cb 44 48 assert (None == enc_url == enc_length == enc_mime_type) or (enc_url is not None and enc_length is not None and enc_mime_type is not None) 45 49 self.enc_url = enc_url … … 96 100 unique_id=link, 97 101 enclosure=enc, 102 pubdate = self.get_pubdate_cb and self.get_pubdate_cb(obj) or None, 98 103 ) 99 104 return f django/branches/i18n/django/views/admin/main.py
r714 r775 524 524 t.append('{%% if not is_popup %%}<input type="submit" value="Save and add another" name="_addanother" %s/>{%% endif %%}' % \ 525 525 (ordered_objects and change and 'onclick="submitOrderForm();"' or '')) 526 t.append(' <input type="submit" value="Save and continue editing" name="_continue" %s/>' % \526 t.append('{%% if not is_popup %%}<input type="submit" value="Save and continue editing" name="_continue" %s/>{%% endif %%}' % \ 527 527 (ordered_objects and change and 'onclick="submitOrderForm();"' or '')) 528 528 t.append('<input type="submit" value="Save" class="default" %s/>' % \ django/branches/i18n/django/views/generic/create_update.py
r492 r775 9 9 10 10 def create_object(request, app_label, module_name, template_name=None, 11 extra_context={}, post_save_redirect=None, login_required=False): 11 template_loader=template_loader, extra_context={}, 12 post_save_redirect=None, login_required=False): 12 13 """ 13 14 Generic object-creation function. … … 66 67 67 68 def update_object(request, app_label, module_name, object_id=None, slug=None, 68 slug_field=None, template_name=None, extra_lookup_kwargs={}, 69 extra_context={}, post_save_redirect=None, login_required=False): 69 slug_field=None, template_name=None, template_loader=template_loader, 70 extra_lookup_kwargs={}, extra_context={}, post_save_redirect=None, 71 login_required=False): 70 72 """ 71 73 Generic object-update function. … … 140 142 def delete_object(request, app_label, module_name, post_delete_redirect, 141 143 object_id=None, slug=None, slug_field=None, template_name=None, 142 extra_lookup_kwargs={}, extra_context={}, login_required=False): 144 template_loader=template_loader, extra_lookup_kwargs={}, 145 extra_context={}, login_required=False): 143 146 """ 144 147 Generic object-delete function. django/branches/i18n/django/views/generic/date_based.py
r312 r775 8 8 9 9 def archive_index(request, app_label, module_name, date_field, num_latest=15, 10 template_name=None, extra_lookup_kwargs={}, extra_context={}): 10 template_name=None, template_loader=template_loader, 11 extra_lookup_kwargs={}, extra_context={}): 11 12 """ 12 13 Generic top-level archive of date-based objects. … … 50 51 51 52 def archive_year(request, year, app_label, module_name, date_field, 52 template_name=None, extra_lookup_kwargs={}, extra_context={}): 53 template_name=None, template_loader=template_loader, 54 extra_lookup_kwargs={}, extra_context={}): 53 55 """ 54 56 Generic yearly archive view. … … 86 88 87 89 def archive_month(request, year, month, app_label, module_name, date_field, 88 month_format='%b', template_name=None, extra_lookup_kwargs={},89 extra_ context={}):90 month_format='%b', template_name=None, template_loader=template_loader, 91 extra_lookup_kwargs={}, extra_context={}): 90 92 """ 91 93 Generic monthly archive view. … … 139 141 def archive_day(request, year, month, day, app_label, module_name, date_field, 140 142 month_format='%b', day_format='%d', template_name=None, 141 extra_lookup_kwargs={}, extra_context={}, allow_empty=False): 143 template_loader=template_loader, extra_lookup_kwargs={}, 144 extra_context={}, allow_empty=False): 142 145 """ 143 146 Generic daily archive view. … … 202 205 month_format='%b', day_format='%d', object_id=None, slug=None, 203 206 slug_field=None, template_name=None, template_name_field=None, 204 extra_lookup_kwargs={}, extra_context={}): 207 template_loader=template_loader, extra_lookup_kwargs={}, 208 extra_context={}): 205 209 """ 206 210 Generic detail view from year/month/day/slug or year/month/day/id structure. django/branches/i18n/django/views/generic/list_detail.py
r618 r775 8 8 9 9 def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False, 10 template_name=None, extra_lookup_kwargs={}, extra_context={}): 10 template_name=None, template_loader=template_loader, 11 extra_lookup_kwargs={}, extra_context={}): 11 12 """ 12 13 Generic list of objects. … … 77 78 def object_detail(request, app_label, module_name, object_id=None, slug=None, 78 79 slug_field=None, template_name=None, template_name_field=None, 79 extra_lookup_kwargs={}, extra_context={}): 80 template_loader=template_loader, extra_lookup_kwargs={}, 81 extra_context={}): 80 82 """ 81 83 Generic list of objects. django/branches/i18n/docs/db-api.txt
r691 r775 525 525 ------------- 526 526 527 For every ``FileField``, the object will have a ``get_FOO_ filename()`` method,527 For every ``FileField``, the object will have a ``get_FOO_url()`` method, 528 528 where ``FOO`` is the name of the field. This returns the full URL to the file, 529 529 according to your ``MEDIA_URL`` setting. If the value is blank, this method django/branches/i18n/docs/model-api.txt
r649 r775 249 249 250 250 The admin represents this as an ``<input type="file">`` (a file-upload widget). 251 251 252 Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few 253 steps: 254 255 1. In your settings file, you'll need to define ``MEDIA_ROOT``as the 256 full path to a directory where you'd like Django to store uploaded 257 files. (For performance, these files are not stored in the database.) 258 Define ``MEDIA_URL`` as the base public URL of that directory. Make 259 sure that this directory is writable by the Web server's user 260 account. 261 262 2. Add the ``FileField`` or ``ImageField`` to your model, making sure 263 to define the ``upload_to`` option to tell Django to which 264 subdirectory of ``MEDIA_ROOT`` it should upload files. 265 266 3. All that will be stored in your database is a path to the file 267 (relative to ``MEDIA_ROOT``). You'll must likely want to use the 268 convenience ``get_<fieldname>_url`` function provided by Django. For 269 example, if your ``ImageField`` is called ``mug_shot``, you can get 270 the absolute URL to your image in a template with ``{{ 271 object.get_mug_shot_url }}``. 272 252 273 .. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941 253 274 … … 282 303 283 304 Requires the `Python Imaging Library`_. 284 305 285 306 .. _Python Imaging Library: http://www.pythonware.com/products/pil/ 286 307 django/branches/i18n/docs/modpython.txt
r642 r775 30 30 </Location> 31 31 32 ...and replace ``myproject.settings.main`` with the path to your settings file,33 in dotted-package syntax.32 ...and replace ``myproject.settings.main`` with the Python path to your 33 settings file. 34 34 35 35 This tells Apache: "Use mod_python for any URL at or under '/mysite/', using the django/branches/i18n/docs/templates_python.txt
r631 r775 268 268 from django.core.template import Context 269 269 import datetime 270 class TimeContext( template.Context):270 class TimeContext(Context): 271 271 def __init__(self, *args, **kwargs): 272 272 Context.__init__(self, *args, **kwargs) django/branches/i18n/docs/templates.txt
r681 r775 377 377 ``forloop.counter`` The current iteration of the loop (1-indexed) 378 378 ``forloop.counter0`` The current iteration of the loop (0-indexed) 379 ``forloop.revcounter`` The number of iterations from the end of the 380 loop (1-indexed) 381 ``forloop.revcounter0`` The number of iterations from the end of the 382 loop (0-indexed) 379 383 ``forloop.first`` True if this is the first time through the loop 380 384 ``forloop.last`` True if this is the last time through the loop django/branches/i18n/docs/tutorial01.txt
r703 r775 386 386 # keyword arguments. 387 387 >>> polls.get_object(id__exact=1) 388 What's up 388 What's up? 389 389 >>> polls.get_object(question__startswith='What') 390 What's up 390 What's up? 391 391 >>> polls.get_object(pub_date__year=2005) 392 What's up 392 What's up? 393 393 >>> polls.get_object(id__exact=2) 394 394 Traceback (most recent call last): … … 396 396 PollDoesNotExist: Poll does not exist for {'id__exact': 2} 397 397 >>> polls.get_list(question__startswith='What') 398 [What's up ]398 [What's up?] 399 399 400 400 # Lookup by a primary key is the most common case, so Django provides a … … 402 402 # The following is identical to polls.get_object(id__exact=1). 403 403 >>> polls.get_object(pk=1) 404 What's up 404 What's up? 405 405 406 406 # Make sure our custom method worked. … … 420 420 # Choice objects have API access to their related Poll objects. 421 421 >>> c.get_poll() 422 What's up 422 What's up? 423 423 424 424 # And vice versa: Poll objects get access to Choice objects. django/branches/i18n/docs/tutorial03.txt
r679 r775 92 92 93 93 The ``poll_id=23`` part comes from ``(?P<poll_id>\d+)``. Using 94 ``(? <name>pattern)`` "captures" the text matched by ``pattern`` and sends it as95 a keyword argument to the view function.94 ``(?P<name>pattern)`` "captures" the text matched by ``pattern`` and sends it 95 as a keyword argument to the view function. 96 96 97 97 Because the URL patterns are regular expressions, there really is no limit on django/branches/i18n/tests/othertests/templates.py
r761 r775 109 109 'for-tag01': ("{% for val in values %}{{ val }}{% endfor %}", {"values": [1, 2, 3]}, "123"), 110 110 'for-tag02': ("{% for val in values reversed %}{{ val }}{% endfor %}", {"values": [1, 2, 3]}, "321"), 111 'for-tag-vars01': ("{% for val in values %}{{ forloop.counter }}{% endfor %}", {"values": [6, 6, 6]}, "123"), 112 'for-tag-vars02': ("{% for val in values %}{{ forloop.counter0 }}{% endfor %}", {"values": [6, 6, 6]}, "012"), 113 'for-tag-vars03': ("{% for val in values %}{{ forloop.revcounter }}{% endfor %}", {"values": [6, 6, 6]}, "321"), 114 'for-tag-vars04': ("{% for val in values %}{{ forloop.revcounter0 }}{% endfor %}", {"values": [6, 6, 6]}, "210"), 111 115 112 116 ### IFEQUAL TAG ###########################################################
