Django

Code

Changeset 749

Show
Ignore:
Timestamp:
09/30/05 12:26:00 (3 years ago)
Author:
rjwittams
Message:

merged r741:748 into new-admin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/new-admin/django/core/rss.py

    r3 r749  
    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/new-admin/docs/db-api.txt

    r691 r749  
    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/new-admin/docs/model-api.txt

    r649 r749  
    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/new-admin/docs/tutorial01.txt

    r703 r749  
    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/new-admin/docs/tutorial03.txt

    r679 r749  
    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