Opened 19 years ago
Closed 16 years ago
#541 closed enhancement (fixed)
[patch] Making generic views use other templates like Zope3 ZPT
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Generic views | Version: | 1.0 |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hi!
I was wondering if it is possible to use other template engines with generic views.
I think making template_loader a parameter of object_list at file list_detail.py, with default value django.core.template_loader should make it flexible enough to use any template engine.
The user could, then, switch to zope3 zpt by adding a key on the dict of the url patterns parameter, like this:
from django.contrib.pagetemplate import pagetemplate info_dict = { 'app_label': 'myapp', 'app_module': 'mymodule', 'template_loader': pagetemplate, }
Hope this will be helpful.
--
João Paulo Fernandes Farias
Attachments (1)
Change History (11)
comment:1 by , 19 years ago
Description: | modified (diff) |
---|---|
Status: | new → assigned |
comment:2 by , 19 years ago
Patch bellow!
Index: django/views/generic/list_detail.py =================================================================== --- django/views/generic/list_detail.py (revisão 661) +++ django/views/generic/list_detail.py (cópia de trabalho) @@ -7,7 +7,8 @@ from django.core.exceptions import Http404, ObjectDoesNotExist def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False, - template_name=None, extra_lookup_kwargs={}, extra_context={}): + template_name=None, template_loader=template_loader, + extra_lookup_kwargs={}, extra_context={}): """ Generic list of objects. @@ -76,7 +77,8 @@ def object_detail(request, app_label, module_name, object_id=None, slug=None, slug_field=None, template_name=None, template_name_field=None, - extra_lookup_kwargs={}, extra_context={}): + template_loader=template_loader, extra_lookup_kwargs={}, + extra_context={}): """ Generic list of objects.
comment:3 by , 19 years ago
milestone: | → Version 1.0 |
---|---|
Summary: | Making generic views use other templates like Zope3 ZPT → [patch] Making generic views use other templates like Zope3 ZPT |
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 16 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Resolution: | fixed |
Status: | closed → reopened |
Version: | → 1.0 |
Since the integration of simple.py in revision @1247 jacob did not include the template_loader argument in direct_to_template. This dead simple patch does it ;)
by , 16 years ago
Attachment: | template_loader_for_direct_to_template.patch added |
---|
template_loader argument for direct_to_template in simple.py
comment:7 by , 16 years ago
PS: It would be nice to have this also in django.contrib.auth.views: http://code.djangoproject.com/ticket/4247
In my case I could reuse these view functions and use my own template system. Otherwise I'd just to copy these views functions over and replace the render_to_response things with my own one.
comment:8 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Please open a new ticket for new feature requests. This ticket was already fixed ages ago and you're essentially asking for a new feature. That way we can keep the history of this ticket clean and decide independently if we want to add the new feature or not.
comment:9 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I was asking for a "feature" in my PS, but not before (I made 3 posts/changes in total). The change before asks for consistency in generic views.
Just as the template_loader argument is in _all_ other generic views, it should also be in direct_to_template. It's clear why it hasn't this feature. In revision 743 when this extra argument was introduced direct_to_template did not exist, and later when direct_to_template was added in revision 1247 jacob simply forgot to make it consistent with the other generic views.
comment:10 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Once again, this particular ticket was closed over three years ago. If something has changed since then, please open a new ticket so that we can track it appropriately. If we decide to "wontfix" your particular changes, for example, it would currently require setting "wontfix" on a ticket that has already been marked as fixed.
Please do not reopen this one.
Sounds like a great idea. I'll add this when I get a moment, but if you want to write a patch that will make it happen quicker.