On Sat, Jun 7, 2008 at 2:54 AM, Nicolas Lara <[EMAIL PROTECTED]> wrote:
>
>> You are explicitly asking for different output, so the fact that
>> different output happens shouldn't be entirely surprising. And
>> remember - In your propsal, you're getting back different output as
>> well - one version has the magic 'groups' member, one doesn't.
>> However, you can't tell that it's different output until you iterate
>> over the result you get back from the call.
>
> I see your point on the problems of mixed output and it is truly a not
> desired flow for working with the data.
> The tuple seems like a solution from the python point of view, but it
> becomes problematic when it comes to templates. What would be the
> method in templates for accesing the data?
>
> {% for old_authors in authors_by_age %}
> ...
> {{ old_authors.0.avg_num_books }}
>
>  {% for same_age in old_authors.1 %}
> ...
> {% endfor %}

Well, you could do it that way - or you could use the tuple syntax in
the for loop:

{% for values, authors in authors_by_age %}

> This would not play well especially with generic views.Of course it is
> always possible to wrap it in a view and add 2 separate variables to
> the context.

This would be unfortunate, but:
1) it's an edge case limitation - worst case, we could live with this
as a limitation
2) We could always update generic views to handle the alternate output syntax.

> Though non of these are the end-all solution, I feel comfortable with
> both (+0). By now I am leaving the tuple solution implemented because
> it is already done and it is very easy to change the output to
> something else (like a dict) in the future (also this feature is not a
> priority).

Agreed. Just make sure that you make a note of this change in a
feature list somewhere. When we get to the point of merging this to
trunk, one of the steps will be to write an email to the other core
developers with a summary of the  changes. This sort of thing is
something that will definitely need to be blessed by other core
developers before it goes into trunk, and we don't want to
accidentally forget to tell them about it.

Yours,
Russ Magee %-)

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