I have been fiddling around to add something to the Admin interface for
a system I'm building. Basically, I am adding a total for the duration
of the set of time tracker elements which are displayed. I did it by
making a copy of change_list.html and adding a call to a custom
template tag. It works "okay", but in looking at ways to make it better
I ran into a difference I'd like to toss around and see if it is my
understanding of it at fault or if I should create an enhancement
ticket for it.

I used the new Admin changes (covered at
http://code.djangoproject.com/wiki/NewAdminChanges in the section
"Admin converted to separate templates") for change_list.html. I am
making use of the "magic" usage of a "templates" directory inside an
app to serve up templates without explcitly adding them to
TEMPLATE_DIRS in settings.py. Therefore, I have a directory like
myproject/myapp/templates/admin/myapp/mymodel with change_list.html in
it. I added my template tag class to the "load" and called it in the
"result_list" block, and it shows the total duration for the events in
the list. That is the "okay" part, because it isn't part of the table
created within the "result_list template tag, so it doesn't look quite
right.

I looked into the result_list tag and saw that it uses
change_list_results.html, and that it renders the actual table, so I
thought I'd put a copy of it in place with the change_list.html. No
joy. I tried every directory up the tree without success. I had to add
a reference to a separate template directory in TEMPLATE_DIRS in
settings.py, then put change_results_list.html into an admin directory
inside that for it to work. Therefore, my two templates which act
together to show a set of results, no live in two completely separate
tree structures.

I wonder whether or not that is desirable. It seems that the "magic" of
having a templates directory within myproject/myapp would be even more
magical if everything could make use of it, and that having those two
related files closer together would make it easier to find them. I know
that I could create a TEMPLATE_DIRS entry and put EVERYTHING in there,
but I like the separation of templates into app-specific branches.

If this should be a ticket, I'd be more than happy to enter it. If I'm
not looking at it right, thanks for any hints in the right direction.

H.B.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to