Malcolm Tredinnick escribió:
> 
> On Tue, 2008-04-01 at 15:42 +0200, Matias Surdi wrote:
> [...]
>> ¿Is this correct? Isn't it a bit tedious to do this with all views? What 
>> if I forget to add the RequestContext thing in a view?
> 
> If you don't pass in the parameters that are required, the function
> won't be able to use them. Surely that isn't confusing.
> 
> If you really find yourself making exactly the same call every single
> time, write yourself a one line function that accepts a 'request'
> parameter in addition to the rest and turns it into a call like the
> above. I personally don't do things that way, since (a) it's pretty much
> just as much typing when you use descriptive function names
> (particularly since any decent editor will only require you to type a
> few characters to get "RequestContext" in the code), (b) explicit coding
> is clearer, (c) I rarely "just" do that one line and instead have a full
> function that does all the common stuff at the end of each view. So I
> end up calling finish_view(request, ...), or whatever my function is,
> each time, and it calls render_to_response(...) amongst other things.
> 
> In short, if you find yourself doing something repeatedly, write a
> function that captures the common stuff if you would find it easier.
> There are many different ways this commonality could display itself, so
> it makes sense for you to write the function that best suits your
> purpose than for Django to ship half a dozen variants that still won't
> be suitable for many purposes.
> 
> Regards,
> Malcolm
> 

In understand this.

I just was looking for any kind of "setting" wich automatically would 
convert all Context objects to RequestContext. I think it's a very 
common situation to need information about the current user logged in 
(for example, his name) in templates.
Anyway, I can wrap this around a function as yo say.

Thanks a lot.


--~--~---------~--~----~------------~-------~--~----~
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