Sort of, but not really because I wanted something that worked even  
using the built-in views (the problem manifested when I started  
working with the login views). I didn't have a problem passing my  
settings into the templates for the views I created myself, but I  
didn't have access to the same arbitrary settings in the templates  
created for the built-in views. I had to use middleware to intercept  
the context and add the variables, even when using views I didn't write.

It seemed like a fair amount of extra work just to make sure all my  
templates had a "media_base_url" variable! :) I've actually changed to  
using plain CGI (rather than manage.py runserver) in development so  
that I don't have to muck about with proxying the Django server and  
other such [*bleep*]...subtleties...to get a coherent environment  
where I can test in the GWT hosted mode browser, desktop Firefox, and  
the iPod Touch, all at the same time.

Thanks!

Jon Brisibn
http://jbrisbin.com

On Jul 17, 2008, at 6:45 PM, [EMAIL PROTECTED] wrote:

>
> Look at these sample code , is this you want ?
>
> from django.template import loader, RequestContext
> def custom_proc(request):
> "A context processor that provides 'app', 'user' and
> 'ip_address'."
> return {
> 'app': 'My app',
> 'user': request.user,
> 'ip_address': request.META['REMOTE_ADDR']
> }
> def view_1(request):
> # ...
> t = loader.get_template('template1.html')
> c = RequestContext(request, {'message': 'I am view 1.'},
> processors=[custom_proc])
> return t.render(c)
>
> On Jul 18, 5:52 am, Jon Brisbin <[EMAIL PROTECTED]> wrote:
>> I was considering this option, but went with some custom middleware,
>> which allows me to mix in some other things I was wanting to add to
>> the context as well...
>>
>> Thanks for the suggestion!
>>
>> Jon Brisibnhttp://jbrisbin.com
>>
>> On Jul 17, 2008, at 4:16 PM, gordyt wrote:
>>
>>
>>
>>> Jon I don't see why you couldn't make a custom template tag (see
>>> http://tinyurl.com/2zlzf6).  I made one to display the current
>>> application revision and so to use it in a template is just this:
>>
>>> {% revision %}
>>
>>> --gordon
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to