Closed GoogleCodeExporter closed 8 years ago
Fantastic suggestion! I opted to use a few different methods that people seem
to
appreciate:
- setting the `extends_template` in the extra_context in your URLconf
- setting the `template_name` in the extra_context in your URLconf
- specifying a value for `DEFAULT_TRACKING_TEMPLATE` in your settings.py
For example, you could override which template the stock
tracking/visitor_map.html
extends by doing something like this:
urlpatterns = patterns('',
(r'^tracking/map/$', 'tracking.views.display_map', {'extends_template':
'admin/base.html'),
(r'^tracking/$', include('tracking.urls')),
)
If you don't change the tracking/visitor_map.html template for anything other
than to
specify which template to extend, this would be useful. If you customize that
template, however, you can either do something like this:
urlpatterns = patterns('',
(r'^tracking/map/$', 'tracking.views.display_map', {'template_name':
'tracking/custom_visitor_map.html'),
(r'^tracking/$', include('tracking.urls')),
)
...or you could just define DEFAULT_TRACKING_TEMPLATE in your settings file as
such:
DEFAULT_TRACKING_TEMPLATE = 'tracking/custom_visitor_map.html'
...and leave the URLconf alone.
You can use any combination of these additions to make things as confusing or as
logical as you'd like :)
Thanks for the suggestion!
Original comment by wheaties...@gmail.com
on 26 Jun 2009 at 3:56
6 hours, that's impressive! I have a couple more thoughts I'll get them added :D
Nick
Original comment by n...@itsnotworking.co.uk
on 26 Jun 2009 at 4:04
Nick,
Yeah, I figured I ought to smash things like this quickly, otherwise it would
just
sink to the back of my memory.. For the record, it would have been done
sooner, but
you posted it about an hour after I went to sleep last night. ;)
I'm interested in your other suggestions!
Original comment by wheaties...@gmail.com
on 26 Jun 2009 at 4:09
[deleted comment]
Ignore last message I thought your examples were editing tracking.urls lol.
Should
learn to read properly.
Nick
Original comment by n...@itsnotworking.co.uk
on 29 Jun 2009 at 11:19
Nick,
I'm glad you got it sorted! I probably should have noted that the urlpatterns
code
above would be in your own urls.py file. ;)
Original comment by wheaties...@gmail.com
on 29 Jun 2009 at 2:44
Original issue reported on code.google.com by
n...@itsnotworking.co.uk
on 26 Jun 2009 at 9:15