Hi all,

Just coming back to Django after an 18 month absense, great to see
some of the work that's gone on here, i'm really impressed! Been using
Rails for a while (not by choice) and it's a joy to get back into
Django.

Enough of the fluffing though, and down to business.

render_to_response is a great shortcut, however in my opinion it's let
down by not supporting request. I see this has been discussed a bit on
the ticket, however that's more in respect to replacing the existing
shortcut.

I propose a new shortcut of the following form:

Index: django/shortcuts/__init__.py
===================================================================
--- django/shortcuts/__init__.py        (revision 5526)
+++ django/shortcuts/__init__.py        (working copy)
@@ -5,11 +5,16 @@
 from django.template import loader
 from django.http import HttpResponse, Http404
 from django.db.models.manager import Manager
+from django.template.context import RequestContext

 def render_to_response(*args, **kwargs):
     return HttpResponse(loader.render_to_string(*args, **kwargs))
 load_and_render = render_to_response # For backwards compatibility.

+def render_to_response_with_req(request, *args, **kwargs):
+    kwargs['context_instance'] = RequestContext(request)
+    return render_to_response(*args, **kwargs)
+
 def get_object_or_404(klass, *args, **kwargs):
     if isinstance(klass, Manager):
         manager = klass

 def get_object_or_404(klass, *args, **kwargs):
     if isinstance(klass, Manager):
         manager = klass

If anyone has any ideas for better names, please chip in.

Regards,

Paul


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to