On 9 December 2010 19:40, Gert Van Gool <gertvang...@gmail.com> wrote: > BTW: what happens when your verbose_name_plural contains a quote (single or > double)? > -- Gert
Or whitespace :) Plus, most people put a ugettext_lazy there, so it's translated in admin model list. I don't think context variable names shouldn't depend on user language, so that's definitely a bug. Using "{model_single_name}_list" should do the trick. Or we can introduce "name_plural" to Meta and also fix this one: http://code.djangoproject.com/ticket/14018 > > On Thu, Dec 9, 2010 at 18:42, Luke Plant <l.plant...@cantab.net> wrote: >> >> Hi, >> >> First, in answer to your question in the title - yes, normally you >> should report bugs like this to Trac, once you are sure you've found a >> bug. >> >> > The problem here is: >> > >> > >> > If i don't set a context_object_name in my app, the method >> > get_context_object_name puts a name based in the verbose_name_plural >> > of my model's name but in the method get_context_data, ithe queryset >> > is set twice, first as 'object_list' and then with the generated name. >> > Querysets being lazy, this is not really a problem in templates, but >> > if I want to serialize that context generated by get_context_data (to >> > create a generic view that outputs results in json), I will load the >> > data twice and that could be a problem. >> >> I don't see anything that makes me think the data will be loaded twice. >> Have you actually seen this happening in practice? Giving a single >> QuerySet object two entries in a dictionary doesn't clone it. >> >> > In the edit,py file (django/views/generic) the >> > class ModelFormMixin inherits from FormMixin and the >> > methods form_invalid from both classes are the same code: >> > >> > >> > return self.render_to_response(self.get_context_data(form=form)) >> > >> > I think the method from ModelFormMixin just should call super from >> > FormMixin, like in form_valid, but perhaps this is intentional. >> >> Even better would be to miss out the method altogether. I can't think >> why right now, but it is possible that it is intentional - if so a >> comment to say why would be better. >> >> Luke >> >> -- >> "My capacity for happiness you could fit into a matchbox without >> taking out the matches first." (Marvin the paranoid android) >> >> Luke Plant || http://lukeplant.me.uk/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers" group. >> To post to this group, send email to django-develop...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-developers+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-developers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-develop...@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > -- Łukasz Rekucki -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.