Django

Code

Changeset 775

Show
Ignore:
Timestamp:
10/04/05 14:34:43 (3 years ago)
Author:
hugo
Message:

i18n: merged r722:774 from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/i18n/django/conf/admin_media/css/changelists.css

    r154 r775  
    1919#changelist {position:relative; width:100%;} 
    2020#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%; } 
    2222.change-list .filtered {min-height:400px; _height:400px;} 
    2323.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; } 
    2525.change-list .filtered table tbody th {padding-right:10px;} 
    2626#changelist .toplinks {border-bottom:1px solid #ccc !important;} 
  • django/branches/i18n/django/conf/global_settings.py

    r768 r775  
    121121 
    122122# Path to the "jing" executable -- needed to validate XMLFields 
    123 JING_PATH = "/usr/bin/jng" 
     123JING_PATH = "/usr/bin/jing" 
    124124 
    125125############## 
  • django/branches/i18n/django/core/defaulttags.py

    r757 r775  
    101101                'counter0': i, 
    102102                'counter': i+1, 
     103                # reverse counter iteration numbers 
     104                'revcounter': len_values - i, 
     105                'revcounter0': len_values - i - 1, 
    103106                # boolean values designating first and last times through loop 
    104107                'first': (i == 0), 
     
    472475        ``forloop.counter``         The current iteration of the loop (1-indexed) 
    473476        ``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) 
    474481        ``forloop.first``           True if this is the first time through the loop 
    475482        ``forloop.last``            True if this is the last time through the loop 
  • django/branches/i18n/django/core/management.py

    r713 r775  
    157157def get_sql_initial_data(mod): 
    158158    "Returns a list of the initial INSERT SQL statements for the given module." 
     159    from django.core import db 
    159160    output = [] 
    160161    app_label = mod._MODELS[0]._meta.app_label 
     
    163164    for klass in mod._MODELS: 
    164165        opts = klass._meta 
     166 
    165167        # 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 
    171176        # Content types. 
    172177        output.append(_get_contenttype_insert(opts)) 
  • django/branches/i18n/django/core/rss.py

    r3 r775  
    88class FeedConfiguration: 
    99    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, 
    1111        enc_url=None, enc_length=None, enc_mime_type=None): 
    1212        """ 
     
    2929        get_list_kwargs_cb -- Function that takes the param and returns a 
    3030        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. 
    3134 
    3235        The three enc_* parameters are strings representing methods or 
     
    4245        self.param_func, self.param_kwargs_cb = param_func, param_kwargs_cb 
    4346        self.get_list_kwargs_cb = get_list_kwargs_cb 
     47        self.get_pubdate_cb = get_pubdate_cb 
    4448        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) 
    4549        self.enc_url = enc_url 
     
    96100                unique_id=link, 
    97101                enclosure=enc, 
     102                pubdate = self.get_pubdate_cb and self.get_pubdate_cb(obj) or None, 
    98103            ) 
    99104        return f 
  • django/branches/i18n/django/views/admin/main.py

    r714 r775  
    524524        t.append('{%% if not is_popup %%}<input type="submit" value="Save and add another" name="_addanother" %s/>{%% endif %%}' % \ 
    525525            (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 %%}' % \ 
    527527        (ordered_objects and change and 'onclick="submitOrderForm();"' or '')) 
    528528    t.append('<input type="submit" value="Save" class="default" %s/>' % \ 
  • django/branches/i18n/django/views/generic/create_update.py

    r492 r775  
    99 
    1010def 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): 
    1213    """ 
    1314    Generic object-creation function. 
     
    6667 
    6768def 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): 
    7072    """ 
    7173    Generic object-update function. 
     
    140142def delete_object(request, app_label, module_name, post_delete_redirect,  
    141143                  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): 
    143146    """ 
    144147    Generic object-delete function. 
  • django/branches/i18n/django/views/generic/date_based.py

    r312 r775  
    88 
    99def 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={}): 
    1112    """ 
    1213    Generic top-level archive of date-based objects. 
     
    5051 
    5152def 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={}): 
    5355    """ 
    5456    Generic yearly archive view. 
     
    8688 
    8789def 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={}): 
    9092    """ 
    9193    Generic monthly archive view. 
     
    139141def archive_day(request, year, month, day, app_label, module_name, date_field, 
    140142                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): 
    142145    """ 
    143146    Generic daily archive view. 
     
    202205                  month_format='%b', day_format='%d', object_id=None, slug=None, 
    203206                  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={}): 
    205209    """ 
    206210    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  
    88 
    99def 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={}): 
    1112    """ 
    1213    Generic list of objects. 
     
    7778def object_detail(request, app_label, module_name, object_id=None, slug=None, 
    7879                  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={}): 
    8082    """ 
    8183    Generic list of objects. 
  • django/branches/i18n/docs/db-api.txt

    r691 r775  
    525525------------- 
    526526 
    527 For every ``FileField``, the object will have a ``get_FOO_filename()`` method, 
     527For every ``FileField``, the object will have a ``get_FOO_url()`` method, 
    528528where ``FOO`` is the name of the field. This returns the full URL to the file, 
    529529according to your ``MEDIA_URL`` setting. If the value is blank, this method 
  • django/branches/i18n/docs/model-api.txt

    r649 r775  
    249249 
    250250    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     
    252273    .. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941 
    253274 
     
    282303 
    283304    Requires the `Python Imaging Library`_. 
    284  
     305     
    285306    .. _Python Imaging Library: http://www.pythonware.com/products/pil/ 
    286307 
  • django/branches/i18n/docs/modpython.txt

    r642 r775  
    3030    </Location> 
    3131 
    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 
     33settings file
    3434 
    3535This tells Apache: "Use mod_python for any URL at or under '/mysite/', using the 
  • django/branches/i18n/docs/templates_python.txt

    r631 r775  
    268268    from django.core.template import Context 
    269269    import datetime 
    270     class TimeContext(template.Context): 
     270    class TimeContext(Context): 
    271271        def __init__(self, *args, **kwargs): 
    272272            Context.__init__(self, *args, **kwargs) 
  • django/branches/i18n/docs/templates.txt

    r681 r775  
    377377        ``forloop.counter``         The current iteration of the loop (1-indexed) 
    378378        ``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) 
    379383        ``forloop.first``           True if this is the first time through the loop 
    380384        ``forloop.last``            True if this is the last time through the loop 
  • django/branches/i18n/docs/tutorial01.txt

    r703 r775  
    386386    # keyword arguments. 
    387387    >>> polls.get_object(id__exact=1) 
    388     What's up 
     388    What's up? 
    389389    >>> polls.get_object(question__startswith='What') 
    390     What's up 
     390    What's up? 
    391391    >>> polls.get_object(pub_date__year=2005) 
    392     What's up 
     392    What's up? 
    393393    >>> polls.get_object(id__exact=2) 
    394394    Traceback (most recent call last): 
     
    396396    PollDoesNotExist: Poll does not exist for {'id__exact': 2} 
    397397    >>> polls.get_list(question__startswith='What') 
    398     [What's up
     398    [What's up?
    399399 
    400400    # Lookup by a primary key is the most common case, so Django provides a 
     
    402402    # The following is identical to polls.get_object(id__exact=1). 
    403403    >>> polls.get_object(pk=1) 
    404     What's up 
     404    What's up? 
    405405 
    406406    # Make sure our custom method worked. 
     
    420420    # Choice objects have API access to their related Poll objects. 
    421421    >>> c.get_poll() 
    422     What's up 
     422    What's up? 
    423423 
    424424    # And vice versa: Poll objects get access to Choice objects. 
  • django/branches/i18n/docs/tutorial03.txt

    r679 r775  
    9292 
    9393The ``poll_id=23`` part comes from ``(?P<poll_id>\d+)``. Using 
    94 ``(?<name>pattern)`` "captures" the text matched by ``pattern`` and sends it as 
    95 a keyword argument to the view function. 
     94``(?P<name>pattern)`` "captures" the text matched by ``pattern`` and sends it 
     95as a keyword argument to the view function. 
    9696 
    9797Because the URL patterns are regular expressions, there really is no limit on 
  • django/branches/i18n/tests/othertests/templates.py

    r761 r775  
    109109    'for-tag01': ("{% for val in values %}{{ val }}{% endfor %}", {"values": [1, 2, 3]}, "123"), 
    110110    '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"), 
    111115 
    112116    ### IFEQUAL TAG ###########################################################