Django

Code

Changeset 2701

Show
Ignore:
Timestamp:
04/15/06 15:12:19 (3 years ago)
Author:
adrian
Message:

magic-removal: Fixed #1643 -- Updated generic views for template extension change

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/views/generic/create_update.py

    r2595 r2701  
    1515    Generic object-creation function. 
    1616 
    17     Templates: ``<app_label>/<model_name>_form`` 
     17    Templates: ``<app_label>/<model_name>_form.html`` 
    1818    Context: 
    1919        form 
     
    5858    form = forms.FormWrapper(manipulator, new_data, errors) 
    5959    if not template_name: 
    60         template_name = "%s/%s_form" % (model._meta.app_label, model._meta.object_name.lower()) 
     60        template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    6161    t = template_loader.get_template(template_name) 
    6262    c = RequestContext(request, { 
     
    7878    Generic object-update function. 
    7979 
    80     Templates: ``<app_label>/<model_name>_form`` 
     80    Templates: ``<app_label>/<model_name>_form.html`` 
    8181    Context: 
    8282        form 
     
    128128    form = forms.FormWrapper(manipulator, new_data, errors) 
    129129    if not template_name: 
    130         template_name = "%s/%s_form" % (model._meta.app_label, model._meta.object_name.lower()) 
     130        template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    131131    t = template_loader.get_template(template_name) 
    132132    c = RequestContext(request, { 
     
    154154    view is POSTed. 
    155155 
    156     Templates: ``<app_label>/<model_name>_confirm_delete`` 
     156    Templates: ``<app_label>/<model_name>_confirm_delete.html`` 
    157157    Context: 
    158158        object 
     
    183183    else: 
    184184        if not template_name: 
    185             template_name = "%s/%s_confirm_delete" % (model._meta.app_label, model._meta.object_name.lower()) 
     185            template_name = "%s/%s_confirm_delete.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    186186        t = template_loader.get_template(template_name) 
    187187        c = RequestContext(request, { 
  • django/branches/magic-removal/django/views/generic/date_based.py

    r2455 r2701  
    1111    Generic top-level archive of date-based objects. 
    1212 
    13     Templates: ``<app_label>/<model_name>_archive`` 
     13    Templates: ``<app_label>/<model_name>_archive.html`` 
    1414    Context: 
    1515        date_list 
     
    3030 
    3131    if not template_name: 
    32         template_name = "%s/%s_archive" % (model._meta.app_label, model._meta.object_name.lower()) 
     32        template_name = "%s/%s_archive.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    3333    t = template_loader.get_template(template_name) 
    3434    c = RequestContext(request, { 
     
    4949    Generic yearly archive view. 
    5050 
    51     Templates: ``<app_label>/<model_name>_archive_year`` 
     51    Templates: ``<app_label>/<model_name>_archive_year.html`` 
    5252    Context: 
    5353        date_list 
     
    6666        raise Http404 
    6767    if not template_name: 
    68         template_name = "%s/%s_archive_year" % (model._meta.app_label, model._meta.object_name.lower()) 
     68        template_name = "%s/%s_archive_year.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    6969    t = template_loader.get_template(template_name) 
    7070    c = RequestContext(request, { 
     
    8686    Generic monthly archive view. 
    8787 
    88     Templates: ``<app_label>/<model_name>_archive_month`` 
     88    Templates: ``<app_label>/<model_name>_archive_month.html`` 
    8989    Context: 
    9090        month: 
     
    118118        raise Http404 
    119119    if not template_name: 
    120         template_name = "%s/%s_archive_month" % (model._meta.app_label, model._meta.object_name.lower()) 
     120        template_name = "%s/%s_archive_month.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    121121    t = template_loader.get_template(template_name) 
    122122    c = RequestContext(request, { 
     
    140140    Generic daily archive view. 
    141141 
    142     Templates: ``<app_label>/<model_name>_archive_day`` 
     142    Templates: ``<app_label>/<model_name>_archive_day.html`` 
    143143    Context: 
    144144        object_list: 
     
    168168        raise Http404 
    169169    if not template_name: 
    170         template_name = "%s/%s_archive_day" % (model._meta.app_label, model._meta.object_name.lower()) 
     170        template_name = "%s/%s_archive_day.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    171171    t = template_loader.get_template(template_name) 
    172172    c = RequestContext(request, { 
     
    203203    Generic detail view from year/month/day/slug or year/month/day/id structure. 
    204204 
    205     Templates: ``<app_label>/<model_name>_detail`` 
     205    Templates: ``<app_label>/<model_name>_detail.html`` 
    206206    Context: 
    207207        object: 
     
    232232        raise Http404, "No %s found for" % model._meta.verbose_name 
    233233    if not template_name: 
    234         template_name = "%s/%s_detail" % (model._meta.app_label, model._meta.object_name.lower()) 
     234        template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    235235    if template_name_field: 
    236236        template_name_list = [getattr(obj, template_name_field), template_name] 
  • django/branches/magic-removal/django/views/generic/list_detail.py

    r2455 r2701  
    1111    Generic list of objects. 
    1212 
    13     Templates: ``<app_label>/<model_name>_list`` 
     13    Templates: ``<app_label>/<model_name>_list.html`` 
    1414    Context: 
    1515        object_list 
     
    7272            c[key] = value 
    7373    if not template_name: 
    74         template_name = "%s/%s_list" % (model._meta.app_label, model._meta.object_name.lower()) 
     74        template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    7575    t = template_loader.get_template(template_name) 
    7676    return HttpResponse(t.render(c)) 
     
    8383    Generic list of objects. 
    8484 
    85     Templates: ``<app_label>/<model_name>_detail`` 
     85    Templates: ``<app_label>/<model_name>_detail.html`` 
    8686    Context: 
    8787        object 
     
    100100        raise Http404, "No %s found matching the query" % (model._meta.verbose_name) 
    101101    if not template_name: 
    102         template_name = "%s/%s_detail" % (model._meta.app_label, model._meta.object_name.lower()) 
     102        template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) 
    103103    if template_name_field: 
    104104        template_name_list = [getattr(obj, template_name_field), template_name] 
  • django/branches/magic-removal/docs/generic_views.txt

    r2549 r2701  
    147147        =======================  ================================================= 
    148148 
    149     Uses the template ``<app_label>/<model_name>_archive`` by default, where: 
     149    Uses the template ``<app_label>/<model_name>_archive.html`` by default, where: 
    150150 
    151151        * ``<model_name>`` is your model's name in all lowercase. For a model 
     
    169169    Takes an optional ``allow_empty`` parameter, as ``archive_index``. 
    170170 
    171     Uses the template ``<app_label>/<model_name>_archive_year`` by default. 
     171    Uses the template ``<app_label>/<model_name>_archive_year.html`` by default. 
    172172 
    173173    Has the following template context: 
     
    194194    template variable to use. Default is ``'object'``. 
    195195 
    196     Uses the template ``<app_label>/<model_name>_archive_month`` by default. 
     196    Uses the template ``<app_label>/<model_name>_archive_month.html`` by default. 
    197197 
    198198    Has the following template context: 
     
    226226    template variable to use. Default is ``'object'``. 
    227227 
    228     Uses the template ``<app_label>/<model_name>_archive_day`` by default. 
     228    Uses the template ``<app_label>/<model_name>_archive_day.html`` by default. 
    229229 
    230230    Has the following template context: 
     
    308308        ========================  ================================================= 
    309309 
    310     Uses the template ``<app_label>/<module_name_list>`` by default. 
     310    Uses the template ``<app_label>/<module_name_list>.html`` by default. 
    311311 
    312312    Has the following template context: 
     
    365365    could use ``post_save_redirect="/polls/%(slug)s/"``. 
    366366 
    367     Uses the template ``<app_label>/<model_name>_form`` by default. This is the 
    368     same template as the ``update_object`` view below. Your template can tell 
    369     the difference by the presence or absence of ``{{ object }}`` in the 
     367    Uses the template ``<app_label>/<model_name>_form.html`` by default. This 
     368    is the same template as the ``update_object`` view below. Your template can 
     369    tell the difference by the presence or absence of ``{{ object }}`` in the 
    370370    context. 
    371371 
     
    391391    template variable to use. Default is ``'object'``. 
    392392 
    393     Uses the template ``<app_label>/<model_name>_form`` by default. 
     393    Uses the template ``<app_label>/<model_name>_form.html`` by default. 
    394394 
    395395    Has the following template context: