Re: Upgrading from Django 1.7: render_to_response and context_instance

2018-08-08 Thread Hanne Moa
This is only used in one app, and one views.py out of 38. There's only this one views.py remaining that uses render_to_response with context_instance. If this was modern Django code written by me I would have used class-based views and a mixin modifying get_context_data (Thank $deity for

RE: Upgrading from Django 1.7: render_to_response and context_instance

2018-08-08 Thread Matthew Pava
.context_processors.messages', 'django.template.context_processors.request', 'general.context_processors.extra_context', ], }, }, ] -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of H

Upgrading from Django 1.7: render_to_response and context_instance

2018-08-08 Thread Hanne Moa
I'm upgrading a rather large code base from django 1.7, with the ultimate goal to have it run on 1.11, as the code isn't fully verified to run on python 3 yet. I'm replacing `render_to_response()` with `render()` everywhere a RequestContext is used, and came upon this (simplified)

Re: render_to_response and HttpResponseRedirect

2015-03-11 Thread elcaiaimar
ulario de cuenca' > > dc=request.POST['descripcion_cuenca'] > idobra=request.POST['obra'] > > cuenca=Cuenca(gid_obra_id=idobra, descripcion_cuenca=dc) > > cuenca.save() > > return rende

render_to_response and HttpResponseRedirect

2015-03-11 Thread elcaiaimar
lo = 'Formulario de cuenca' dc=request.POST['descripcion_cuenca'] idobra=request.POST['obra'] cuenca=Cuenca(gid_obra_id=idobra, descripcion_cuenca=dc) cuenca.save() return render_to_response('ob

Re: HttpResponseRedirect vs render_to_response

2014-05-18 Thread Daniel Roseman
gt; I want passed on (in this case a simple geographic location such as a city > or zip code)? Again, I know I can do it with render, but the linked post > suggests otherwise. > > The writer of hte post also said that, in the context of > render_to_response that it should be used m

HttpResponseRedirect vs render_to_response

2014-05-18 Thread Colin Ma
but the linked post suggests otherwise. The writer of hte post also said that, in the context of render_to_response that it should be used most of the time. Help would be appreciated, thanks! -- You received this message because you are subscribed to the Google Groups "Django users&qu

Re: call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
I don't know what is happening but I've solved with a workaround: dummy = self.request.user.is_authenticated() calling is_authenticated before returning render_to_response solves the problem, because request.user is "casted" to the actual user instance, in

Re: call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
The problem seems to be related with SimpleLazyObject, wrapping the auth.user. If during debugging I access the function, everything works fine. It's enough to have the Variables windows open in PyDev. If I do not access it, it isn't resolved to the actual user instance (in my case AnonymousUser

call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
st context processors. I paste an excerpt, where I do the render_to_response call directly from the form_valid method, just to test it. class ProjectCreateView(FormView): """Create view.""" (...) def form_valid(self, form): &

Re: render_to_response pointing to multiple templates

2011-12-27 Thread laras126
ur assistance > > > > > > > > On Mon, Nov 7, 2011 at 2:04 PM, Tom Evans wrote: > > On Mon, Nov 7, 2011 at 3:59 PM, jay K. > > wrote: > > > hi, Tom > > > > thanks for the reply > > > > what I actually want to do is to > > &g

Re: Unable to load render_to_response module

2011-11-11 Thread Ganesh Kumar
s about 'object'. ?object also works, ?? prints more. In [1]: from django.shortcuts import render_to_response In [2]: thanks guys. -Ganesh. Did I learn something today? If not, I wasted it. On Fri, Nov 11, 2011 at 9:06 PM, Daniel Roseman wrote: > On Friday, 11 November 2011 1

Re: Unable to load render_to_response module

2011-11-11 Thread 马博文
met the same problem the solution. Thans again. regards, Bowen 在 2011年11月11日星期五,Daniel Roseman 写道: > On Friday, 11 November 2011 13:49:08 UTC, Ganesh-Bugcy wrote: >> >> Hi , >> >> I have tried to load render_to_response module. it's through error. I >> have

Re: Unable to load render_to_response module

2011-11-11 Thread Bowen
: > Hi , > > I have tried to load render_to_response module. it's through error. I > have tried download and install the module > https://github.com/jgorset/django-shortcuts > installed sucessfully, But not load any one of you help me guys. > > > dhana013 ~ $ ipython

Re: Unable to load render_to_response module

2011-11-11 Thread Daniel Roseman
On Friday, 11 November 2011 13:49:08 UTC, Ganesh-Bugcy wrote: > > Hi , > > I have tried to load render_to_response module. it's through error. I > have tried download and install the module > https://github.com/jgorset/django-shortcuts > installed sucessfully, But not lo

Unable to load render_to_response module

2011-11-11 Thread Ganesh Kumar
Hi , I have tried to load render_to_response module. it's through error. I have tried download and install the module https://github.com/jgorset/django-shortcuts installed sucessfully, But not load any one of you help me guys. dhana013 ~ $ ipython Python 2.6.5 (r265:79063, Apr 16 2010,

Re: from django.shortcuts import render_to_response

2011-11-10 Thread Tom Evans
On Thu, Nov 10, 2011 at 11:26 AM, Ganesh Kumar wrote: > Hi > How to install  render_to_response module. > please guide me. > > In [10]: from django.shortcuts import render_to_response > ---

from django.shortcuts import render_to_response

2011-11-10 Thread Ganesh Kumar
Hi How to install render_to_response module. please guide me. In [10]: from django.shortcuts import render_to_response --- ImportError Traceback (most recent call last) /root/django-shortcuts

Re: render_to_response pointing to multiple templates

2011-11-08 Thread jay K.
ote: > > hi, Tom > > > > thanks for the reply > > > > what I actually want to do is to > > list several templates in the render_to_response > > function and be able to choose which one to use > > > > can I choose which template to use? > > >

Re: render_to_response pointing to multiple templates

2011-11-07 Thread Joey Espinosa
PM, Tom Evans wrote: > On Mon, Nov 7, 2011 at 3:59 PM, jay K. > wrote: > > hi, Tom > > > > thanks for the reply > > > > what I actually want to do is to > > list several templates in the render_to_response > > function and be able to choose which

Re: render_to_response pointing to multiple templates

2011-11-07 Thread Tom Evans
On Mon, Nov 7, 2011 at 3:59 PM, jay K. wrote: > hi, Tom > > thanks for the reply > > what I actually want to do is to > list several templates in the render_to_response > function and be able to choose which one to use > > can I choose which template to use? > >

Re: render_to_response pointing to multiple templates

2011-11-07 Thread jay K.
hi, Tom thanks for the reply what I actually want to do is to list several templates in the render_to_response function and be able to choose which one to use can I choose which template to use? thanks again, and let me know if my question is clear enough On Mon, Nov 7, 2011 at 12:18 PM, Tom

Re: render_to_response pointing to multiple templates

2011-11-07 Thread Tom Evans
On Mon, Nov 7, 2011 at 3:09 PM, jay K. wrote: > > Hello > > I have a view with the following render_to_template function > > ... > > return render_to_response( 'template/template.html', {var'': var}, > context_instance=RequestContext(request)) >

render_to_response pointing to multiple templates

2011-11-07 Thread jay K.
Hello I have a view with the following render_to_template function ... return render_to_response( 'template/template.html', {var'': var}, context_instance=RequestContext(request)) ... I want the render_to_response to point to more than 1 template. So far I've tri

Re: render_to_response a HTML msg

2011-03-10 Thread Bill Freeman
it possible to make some kind of injection using it >> this way? Is autoescape a better option? >> > > They are all variants of the same thing. These are all equivalent: > > {{ foo|safe }} > > {% autoescape off %} > {{ foo }} > {% endautoescape %} > >

Re: render_to_response a HTML msg

2011-03-10 Thread Tom Evans
autoescape a better option? > They are all variants of the same thing. These are all equivalent: {{ foo|safe }} {% autoescape off %} {{ foo }} {% endautoescape %} from django.utils.safestring import mark_safe return render_to_response('...', { 'foo': mark_safe(foo) }) They

Re: render_to_response a HTML msg

2011-03-10 Thread Thiago Carvalho D' Ávila
> template > > variable. > > > > What I am doing is: > > > > view.py > > def view(request, id): > >thing = get_object_or_404(Object, pk=id) > >if blablabla: > > return render_to_response('template.html'), >

Re: render_to_response a HTML msg

2011-03-10 Thread Bill Freeman
gt; > What I am doing is: > > view.py > def view(request, id): >    thing = get_object_or_404(Object, pk=id) >    if blablabla: >       return render_to_response('template.html'), > {'html_message': ' We recommend that you click href="thing.get_upd

Re: render_to_response a HTML msg

2011-03-10 Thread Gennadiy Zlobin
as a template > variable. > > What I am doing is: > > *view.py* > def view(request, id): >thing = get_object_or_404(Object, pk=id) >if blablabla: > return render_to_response('template.html'), > {'html_message': ' We recommend that you cl

Re: render_to_response a HTML msg

2011-03-10 Thread Tom Evans
2011/3/10 Thiago Carvalho D' Ávila : > I'm having some problem while trying to render some HTML code as a template > variable. > > What I am doing is: > > view.py > def view(request, id): >    thing = get_object_or_404(Object, pk=id) >    if blablab

render_to_response a HTML msg

2011-03-10 Thread Thiago Carvalho D' Ávila
I'm having some problem while trying to render some HTML code as a template variable. What I am doing is: *view.py* def view(request, id): thing = get_object_or_404(Object, pk=id) if blablabla: return render_to_response('template.html'), {'html_message': 

Re: render_to_response format using forms

2011-01-07 Thread Daniel Roseman
On Friday, January 7, 2011 4:05:27 PM UTC, hank23 wrote: > > Another question about forms. So the form name or names that I pass in > the dictionary to the response can also be named anything and aren't > required to be of a specific form name format right? > Yes, that's correct. There's no nam

Re: render_to_response format using forms

2011-01-07 Thread hank23
t; > return render_to_response('contact.html', >     { my_data_dictionary(including an entry for 'form': form) }, >     context_instance=RequestContext(request)) > > On Jan 7, 9:42 am, Daniel Roseman wrote: > > > > > On Friday, January 7, 2011 3:38:

Re: render_to_response format using forms

2011-01-07 Thread hank23
I see. So then I would code it something like this then: return render_to_response('contact.html', { my_data_dictionary(including an entry for 'form': form) }, context_instance=RequestContext(request)) On Jan 7, 9:42 am, Daniel Roseman wrote: > On Friday, Jan

Re: render_to_response format using forms

2011-01-07 Thread Daniel Roseman
On Friday, January 7, 2011 3:38:10 PM UTC, hank23 wrote: > > So then when using a form do I code it something like this then: > > > return render_to_response('contact.html', { > 'form': form, > my_data_dictionary, > context_instance=R

Re: render_to_response format using forms

2011-01-07 Thread hank23
So then when using a form do I code it something like this then: return render_to_response('contact.html', { 'form': form, my_data_dictionary, context_instance=RequestContext(request)) }) I ask because it's confusing me when using a form for how to code

Re: render_to_response format using forms

2011-01-07 Thread Daniel Roseman
On Friday, January 7, 2011 3:15:33 PM UTC, hank23 wrote: > > In the topics forms documentation there's an example of using a form > in a view which shows a return statement using a render_to_respone > shortcut like this: > > return render_to_response('contact.h

render_to_response format using forms

2011-01-07 Thread hank23
In the topics forms documentation there's an example of using a form in a view which shows a return statement using a render_to_respone shortcut like this: return render_to_response('contact.html', { 'form': form, }) but in the shortcuts documentation it

Re: render_to_response

2011-01-03 Thread Greg Turner
Just have my_fnc return a dictionary (or other object), rather than the whole rendered response: def search(request): .. answ = my_fnc(roots) return render_to_response("my_fnc.html", { "answ" : answ['FindWord'] } ) def my_fnc( roots ): FindWor

render_to_response

2011-01-03 Thread gintare
How formulate correctly the code below: [code] #views.py def search(request): .. answ = my_fnc(roots) return render_to_response("my_fnc.html", { "answ" : answ } ) def my_fnc( roots ): FindWord=authors.objects.filter("name"__contains=roots)

Re: writing HTML Code into Template with render_to_response: How?

2010-08-25 Thread Casey S. Greene
I would caution that what you are doing may make maintenance difficult later. You may want to evaluate using whether creating the table in the template is more appropriate. -- Casey On 08/25/2010 09:21 AM, Tim Sawyer wrote: On 25/08/10 13:36, mdolphin wrote: OK, that's probably a Newbee Que

Re: writing HTML Code into Template with render_to_response: How?

2010-08-25 Thread Simon Holness
Use the "safe" filter to disable the auto-escaping that templates apply to all variables: http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#safe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djan

Re: writing HTML Code into Template with render_to_response: How?

2010-08-25 Thread Tim Sawyer
On 25/08/10 13:36, mdolphin wrote: OK, that's probably a Newbee Question: My Code generates an HTML-Table, that I want to show up inside a {% block %} in my Template. All I get is an encoded output of my generated HTML-Sourcecode inside the Template. so i.e becomes and so on. How could I a

writing HTML Code into Template with render_to_response: How?

2010-08-25 Thread mdolphin
OK, that's probably a Newbee Question: My Code generates an HTML-Table, that I want to show up inside a {% block %} in my Template. All I get is an encoded output of my generated HTML-Sourcecode inside the Template. so i.e becomes and so on. How could I achieve it to get my generated HTML- C

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Alex
Thanks all! I will try a combination of these pointers. server/client communication patterns seems to be a recurring theme (or nightmare!) of mine. This conversation has been very helpful and reassuring - I can see that the hard and fast rule is 'when in doubt, json it'

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Matt Hoskins
On Jun 17, 10:31 am, Ian McDowall wrote: > > In some cases, I don't use templates to build a JSON response.  It can > be straightforward to write it as a string inline.  I don't personally > yet use the built in Python JSON module as I don't want to limit the > Python versions that I can deploy

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Ian McDowall
Sorry, other posters have picked up two of my errors. It is a while since I used application/json and I was running on (incorrect) memory. My reasoning for using plain text is as follows. I regard parsing JSON using eval() as a security risk on the client side. If you have complete control of th

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Matt Hoskins
I was just copying Ian's choice of mimetype - see Ian's comment above "I choose text/plain deliberately but you might choose text/json (or something else)."... Although it's worth pointing out that "text/json" shouldn't be used, since "application/json" is, as you rightly point, the mimetype for js

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Dmitry Dulepov
Hi! Matt Hoskins wrote: > return HttpResponse(simplejson.dumps(data),mimetype='text/plain) Small correction: mime type should be application/json. -- Dmitry Dulepov Twitter: http://twitter.com/dmitryd/ Web: http://dmitry-dulepov.com/ -- You received this message because you are subscribed to

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Matt Hoskins
Django has an escapejs filter so if you're using a template to generate json you'd be safer doing, e.g.: "first_name":"{{ one_member.first_name|escapejs }}" That way if someone sticks something untoward (like a double quote) in your first_name or last_name fields it won't break things :). For th

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Ian McDowall
contain characters that break the JSON (e.g. quotation marks). Cheers Ian On Jun 16, 8:46 pm, Alex wrote: > Thanks all. I may go with Matt's idea of serialising html + other data > to json and decoding client side. I'm not totally keen though because > this abandons a very

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Alex
Thanks all. I may go with Matt's idea of serialising html + other data to json and decoding client side. I'm not totally keen though because this abandons a very nice rollup of functionality in django's render_to_response (I am not familiar with how to write the template as JSON a

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Ian McDowall
gt; Please can anyone help with an app architecture problem I am having? > (I am quite new to Django) > > I have an app which which serves up XHR requests (via YUI3 io > uitility) to urlpatterns.  The views make HttpResponses using > render_to_response like so: > > retu

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Matt Hoskins
Perhaps instead of using render_to_response to generate the response, render the template output to a string and then stuff that in the data structure that you serialise to json along with the other data? Regards, Matt On Jun 16, 1:17 pm, Alex wrote: > > But the problem I have - and I

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Tom Evans
e HttpResponses using > render_to_response like so: > > return render_to_response("registration/register.html", { >        'form': form, >    }, context_instance=RequestContext(request)) > > That is all fine: The html content is rendered in the relevant div > (using a

how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Alex
Hi, Please can anyone help with an app architecture problem I am having? (I am quite new to Django) I have an app which which serves up XHR requests (via YUI3 io uitility) to urlpatterns. The views make HttpResponses using render_to_response like so: return render_to_response("registr

Re: Help me with render_to_response!

2010-05-26 Thread Nate
def my_root_page(request): #t = get_template('root.html') html = 'Please Work!' #t.render(Context({})) return HttpResponse(html) def current_datetime(request): now = datetime.datetime.now() return render_to_response('current_datetime.html', {&#

Re: Help me with render_to_response!

2010-05-26 Thread Daniel Roseman
On May 26, 8:19 pm, Nate wrote: > I'm teaching myself django and I'm having an issue with > render_to_response.  I am passing it a template and a dictionary. > When I view the page on a local host, it displays the entire template, > including HTML tags, instead of formatting

Help me with render_to_response!

2010-05-26 Thread Nate
I'm teaching myself django and I'm having an issue with render_to_response. I am passing it a template and a dictionary. When I view the page on a local host, it displays the entire template, including HTML tags, instead of formatting the page according to the tags. I don't have

Re: render_to_response and HTTP status codes other than 200

2009-12-04 Thread chefsmart
Yeah it's a twisted idea, but I'm going to use it for informative 403 405 pages. On Dec 4, 3:51 pm, Daniel Roseman wrote: > On Dec 4, 8:37 am, chefsmart wrote: > > > According to the docs > > athttp://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to..

Re: render_to_response and HTTP status codes other than 200

2009-12-04 Thread Daniel Roseman
On Dec 4, 8:37 am, chefsmart wrote: > According to the docs > athttp://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to... > the render_to_response shortcut "Renders a given template with a given > context dictionary and returns an HttpResponse object with tha

render_to_response and HTTP status codes other than 200

2009-12-04 Thread chefsmart
According to the docs at http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response the render_to_response shortcut "Renders a given template with a given context dictionary and returns an HttpResponse object with that rendered text." The HttpResponse object have

Re: How to get rid of anchor in url when rendering via render_to_response()

2009-12-01 Thread Margie Roginski
e > > >http://www.example.com/taskamanger/edit_task/5 > > > They make some change to the task - say change the due date.  But they > > make an error which is caught on the server side.  When my server code > > runs, it calls render_to_response to re-render the page t

Re: How to get rid of anchor in url when rendering via render_to_response()

2009-12-01 Thread Bill Freeman
nger/edit_task/5 > > They make some change to the task - say change the due date.  But they > make an error which is caught on the server side.  When my server code > runs, it calls render_to_response to re-render the page to display the > error.  Howevever, because their original u

How to get rid of anchor in url when rendering via render_to_response()

2009-12-01 Thread Margie Roginski
make an error which is caught on the server side. When my server code runs, it calls render_to_response to re-render the page to display the error. Howevever, because their original url was http://www.example.com/taskmanager/edit_task/5#comment_4 they are now taken back to the page with comment_4

Re: render_to_response taking 50 seconds!

2009-11-11 Thread Carl Zmola
Did you isolate the problem yet? It could also be the query itself. You might have to add indexes into the database to get good results. How much time does the query take if you run it in naive SQL without the rendering? Low Kian Seong wrote: > Pretty much confirmed it's the rendering or pul

Re: render_to_response taking 50 seconds!

2009-11-03 Thread Low Kian Seong
On 11/3/09, esatterwh...@wi.rr.com wrote: > > You might want to consider installing the debug toolbar ( > http://github.com/robhudson/django-debug-toolbar ). Yeah, I tried this before but then when you are trying to generate an Excel spreadsheet somehow it fails to capture the right data and dis

Re: render_to_response taking 50 seconds!

2009-11-03 Thread Михаил Лукин
I strongly suggest you to use pagination here. 2009/11/3 Low Kian Seong > > I have about 3k plus record in my db table and am trying to do a > simple render_to_response of a template sending it the results of a > query. I debugged this and found that the total time taken for an >

Re: render_to_response taking 50 seconds!

2009-11-03 Thread bruno desthuilliers
On 3 nov, 12:12, Low Kian Seong wrote: > Pretty much confirmed it's the rendering or pulling of data from database: > > 1. I tried to render a html page instead of Excel. Same speed. > So this > kicks out the theory of rending of excel is slowing the page down. I assume you meant "csv", not "Exc

Re: render_to_response taking 50 seconds!

2009-11-03 Thread esatterwh...@wi.rr.com
You might want to consider installing the debug toolbar ( http://github.com/robhudson/django-debug-toolbar ). it displays the amount of time taken for all of the rendering steps. It will defiantly help you narrow down the major culprits. On Nov 3, 5:12 am, Low Kian Seong wrote: > Pretty much co

Re: render_to_response taking 50 seconds!

2009-11-03 Thread Low Kian Seong
Pretty much confirmed it's the rendering or pulling of data from database: 1. I tried to render a html page instead of Excel. Same speed. So this kicks out the theory of rending of excel is slowing the page down. 2. I tried shorting out all the data from the rendered page. Page came up in less t

Re: render_to_response taking 50 seconds!

2009-11-03 Thread bruno desthuilliers
On 3 nov, 09:09, Low Kian Seong wrote: > But I am confused here. How do iterate through the data another time? > Do I call the select_related in my views.py code like: > > manager_info = found_entries.select_related() > > then how do i iterate through manager_info in my template? That's not how

Re: render_to_response taking 50 seconds!

2009-11-03 Thread James Bennett
On Tue, Nov 3, 2009 at 1:17 AM, Low Kian Seong wrote: > There is a query page where the start_date and end_date is being sent. > Then the do_defender_advanced will process it and generate an Excel > using the template. One other thing is that the Django template system isn't really optimized for

Re: render_to_response taking 50 seconds!

2009-11-03 Thread Low Kian Seong
On Tue, Nov 3, 2009 at 3:41 PM, James Bennett wrote: > > On Tue, Nov 3, 2009 at 1:17 AM, Low Kian Seong wrote: >> There is a query page where the start_date and end_date is being sent. >> Then the do_defender_advanced will process it and generate an Excel >> using the template. > > For each obje

Re: render_to_response taking 50 seconds!

2009-11-03 Thread Low Kian Seong
;>>>> Low Kian Seong kirjoitti: >>>>>> I have about 3k plus record in my db table and am trying to do a >>>>>> simple render_to_response of a template sending it the results of a >>>>>> query. I debugged this and fo

Re: render_to_response taking 50 seconds!

2009-11-02 Thread Jani Tiainen
Kian Seong kirjoitti: >>>>> I have about 3k plus record in my db table and am trying to do a >>>>> simple render_to_response of a template sending it the results of a >>>>> query. I debugged this and found that the total time taken for an >>>>&

Re: render_to_response taking 50 seconds!

2009-11-02 Thread James Bennett
On Tue, Nov 3, 2009 at 1:17 AM, Low Kian Seong wrote: > There is a query page where the start_date and end_date is being sent. > Then the do_defender_advanced will process it and generate an Excel > using the template. For each object you are displaying the values of four foreign keys. Each time

Re: render_to_response taking 50 seconds!

2009-11-02 Thread Low Kian Seong
On Tue, Nov 3, 2009 at 3:07 PM, Jani Tiainen wrote: > > Low Kian Seong kirjoitti: >> On Tue, Nov 3, 2009 at 1:33 PM, Jani Tiainen wrote: >>> Low Kian Seong kirjoitti: >>>> I have about 3k plus record in my db table and am trying to do a >>>> simpl

Re: render_to_response taking 50 seconds!

2009-11-02 Thread Jani Tiainen
Low Kian Seong kirjoitti: > On Tue, Nov 3, 2009 at 1:33 PM, Jani Tiainen wrote: >> Low Kian Seong kirjoitti: >>> I have about 3k plus record in my db table and am trying to do a >>> simple render_to_response of a template sending it the results of a >>> query

Re: render_to_response taking 50 seconds!

2009-11-02 Thread Low Kian Seong
On Tue, Nov 3, 2009 at 1:33 PM, Jani Tiainen wrote: > > Low Kian Seong kirjoitti: >> I have about 3k plus record in my db table and am trying to do a >> simple render_to_response of a template sending it the results of a >> query. I debugged this and found that the

Re: render_to_response taking 50 seconds!

2009-11-02 Thread Javier Guerra
On Mon, Nov 2, 2009 at 10:44 PM, Low Kian Seong wrote: > I have about 3k plus record in my db table and am trying to do a > simple render_to_response of a template sending it the results of a > query. I debugged this and found that the total time taken for an > operation like this i

Re: render_to_response taking 50 seconds!

2009-11-02 Thread Jani Tiainen
Low Kian Seong kirjoitti: > I have about 3k plus record in my db table and am trying to do a > simple render_to_response of a template sending it the results of a > query. I debugged this and found that the total time taken for an > operation like this is 50 seconds! Is there anyway t

render_to_response taking 50 seconds!

2009-11-02 Thread Low Kian Seong
I have about 3k plus record in my db table and am trying to do a simple render_to_response of a template sending it the results of a query. I debugged this and found that the total time taken for an operation like this is 50 seconds! Is there anyway to speed this up? -- Low Kian Seong blog

Re: Do I have to pass the httprequest object to render_to_response every time?

2009-10-22 Thread Bayuadji
IMHO Yes, otherwise the context_processor variable won't be available in template -djibon- On Thu, Oct 22, 2009 at 11:43 AM, jul wrote: > > But I still have to pass RequestContext(request) to render_to_response > if I'm not using generic views, right? > > On Oct 2

Re: Do I have to pass the httprequest object to render_to_response every time?

2009-10-22 Thread jul
But I still have to pass RequestContext(request) to render_to_response if I'm not using generic views, right? On Oct 21, 8:38 pm, Andrew Ingram wrote: > jul wrote: > > hi, > > > in my base.html template I've got a header which needs httprequest > > (request.p

Re: Do I have to pass the httprequest object to render_to_response every time?

2009-10-21 Thread Andrew Ingram
jul wrote: > hi, > > in my base.html template I've got a header which needs httprequest > (request.path, request.user.is_authenticated...). > In all my views I'm passing the request object to render_to_response. > Is there any better way to do that? > > thanks

Do I have to pass the httprequest object to render_to_response every time?

2009-10-21 Thread jul
hi, in my base.html template I've got a header which needs httprequest (request.path, request.user.is_authenticated...). In all my views I'm passing the request object to render_to_response. Is there any better way to do that?

Re: render_to_response fails with TemplateSyntaxError: too many values to unpack

2009-08-18 Thread girzel
On Wed, Aug 19, 2009 at 8:30 AM, Janne Peltola wrote: > > Template rendering fails when both form data and a tuple are passed to > render_to_response. > > Python: 2.6.2; Django: 1.1; Environment: Windows + built-in dev server > > I use the standard django.contrib.auth.m

render_to_response fails with TemplateSyntaxError: too many values to unpack

2009-08-18 Thread Janne Peltola
Template rendering fails when both form data and a tuple are passed to render_to_response. Python: 2.6.2; Django: 1.1; Environment: Windows + built-in dev server I use the standard django.contrib.auth.models.User and .Group models. View: class FuksiForm(forms.Form): ryhmat

Re: best approaches with render_to_response and large forms

2009-07-21 Thread Shawn Milochik
On Jul 21, 2009, at 5:21 PM, Juan Hernandez wrote: > Hi there, > > i have two questions in my mind. > > 1- Let's say that I have tens of views. Do I always have to use > render_to_response? I find it totally against DRY. My solution was > creating a wrapper that w

best approaches with render_to_response and large forms

2009-07-21 Thread Juan Hernandez
Hi there, i have two questions in my mind. 1- Let's say that I have tens of views. Do I always have to use render_to_response? I find it totally against DRY. My solution was creating a wrapper that would take as arguments the template file name and a dictionary with all the parameters for

Re: override render_to_response

2009-03-17 Thread matehat
I think the closest you could get to a painless implementation of what you need, for existing apps, could be to create a method named something like "render_to_json_response", that behave the way you want and have the appropriate "views" modules in each app import it as

Re: override render_to_response

2009-03-16 Thread Malcolm Tredinnick
On Mon, 2009-03-16 at 18:34 -0700, Preston Timmons wrote: > I am wondering if render_to_response is really the proper function you > are looking for. > > For instance, here is a simple view that returns json using > HttpResponse without need of a template: He was wanting to hi

Re: override render_to_response

2009-03-16 Thread Preston Timmons
I am wondering if render_to_response is really the proper function you are looking for. For instance, here is a simple view that returns json using HttpResponse without need of a template: import simplejson from django.http import HttpResponse def output_json(request): data = [ dict

Re: override render_to_response

2009-03-16 Thread Malcolm Tredinnick
On Mon, 2009-03-16 at 20:05 -0400, Malinka Rellikwodahs wrote: [...] > Unless I'm mistaken it should be fairly simple in this case to create > your own set of templates for each of the django apps you're using and > then have them output the data you need as json text instead of as > html Ooh ...

Re: override render_to_response

2009-03-16 Thread Malinka Rellikwodahs
ext dict > as JSON instead > of rendering the html template. > > Is it possible to override render_to_response so all the apps using it will > respond with JSON without > actually touching the apps code? I don't want to create a middleware that > will modify the response

Re: override render_to_response

2009-03-16 Thread Malcolm Tredinnick
> context dict as JSON instead > of rendering the html template. > > Is it possible to override render_to_response so all the apps using it > will respond with JSON without > actually touching the apps code? Not really, no. Monkey-patching like that is gene

override render_to_response

2009-03-16 Thread a b
o override render_to_response so all the apps using it will respond with JSON without actually touching the apps code? I don't want to create a middleware that will modify the response because then I have the overhead of rendering the html template. Thanks --~--~-~--~~~-

Re: weird behaviour of forms in render_to_response

2009-03-14 Thread ihomest...@gmail.com
t version and have some problem > > with the render_to_response to render a template. Here is a short > > snippet: > > >     return render_to_response('index.html', { > >         'form': form, > >         'ops' : ops, > >       })

Re: weird behaviour of forms in render_to_response

2009-03-13 Thread Malcolm Tredinnick
On Fri, 2009-03-13 at 21:08 -0700, ihome wrote: > Hi, > > I am using the latest django development version and have some problem > with the render_to_response to render a template. Here is a short > snippet: > > return render_to_response('index.html&

  1   2   >