Opened 18 years ago
Closed 18 years ago
#3667 closed (wontfix)
Useful optional argument for generic views
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | Keywords: | Optional Arguments, Date-Based | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hello everybody, i played a bit with generic views and thought, that it would be useful to have a 'template_base' optional argument. If you want to pass a custom template to a generic view, you currently have to add a 'template_name' argument to the parameter dictionary. For example, i have an app called 'blog' with a template-folder inside, Django has no problem with that, but the default generic views want to see my html-files in 'blog/templates/blog/'. So, when i provide something like this:
info_dict = { 'queryset' : Spam.objects.all(), 'date_field' : 'pub_date', }
i would like to have that:
info_dict = { 'queryset' : Spam.objects.all(), 'date_field' : 'pub_date', 'template_base' : 'templates', }
This would simplyfy my URLconfs, currently if have to do a
... dict(blog_dict,template_name='Spam.html'), ...
in every URLconf. Maybe you could give it a tought.
Change History (2)
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 18 years ago
Description: | modified (diff) |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This just seems to be a different way of achieving what can already be done using
template_name
. If you want slightly different syntax, you can wrap the generic view calls in your own function or class (with a__call__
method) and use that.