Re: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-30 Thread Nicolas Steinmetz

For the record, I modified a little bit my object but the key was in 
precising a lot |dictsort like the following case :

{# -- Compétences techniques -- #}
{% if user_techskill %}
Comptences techniques :
{% for tskill in user_techskill %}
{% regroup tskill.name.all|dictsort:"domain.id" by domain as 
grouped %}

 {% for group in grouped %}
 {{ group.grouper }} :
{% for item in group.list %}
{{ item.name }},
{% endfor %}

 {% endfor %}

{% endfor %}
{% endif %}

Regards,
Nicolas


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



Re: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-21 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :
> Nicolas Steinmetz a écrit :
> [...]
> 
>> I tried this but the bug persists. Sometimes it works well (technical 
>> skills are well regrouped by technical domaines) but if I refresh, it's 
>> no longer the case.
>>
>> I even tried this on an easier object and it does not work more 
>> efficiently (user_skill in my view). If I do not add .order_by() in the 
>> view, and add the |dictsort:"" filter, I have the same bug. If I add the 
>> order_by() and the dictsort filter, bug remains. It only works well if I 
>> add the order_by() and remove the dictsort filter.
>>
>> However for the 1st object on which I had the bug, I cannot sort it in 
>> my views unless I decompose my model...
>>
>> Any other clue ?
> 
> So should I fill a ticket or do I make something wrong ?

small up before filling tickets :)

For a more readable view on my files :

 
(line 38 > 138)

 
(lines 108/116)


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



Re: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-19 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :
[...]

> I tried this but the bug persists. Sometimes it works well (technical 
> skills are well regrouped by technical domaines) but if I refresh, it's 
> no longer the case.
> 
> I even tried this on an easier object and it does not work more 
> efficiently (user_skill in my view). If I do not add .order_by() in the 
> view, and add the |dictsort:"" filter, I have the same bug. If I add the 
> order_by() and the dictsort filter, bug remains. It only works well if I 
> add the order_by() and remove the dictsort filter.
> 
> However for the 1st object on which I had the bug, I cannot sort it in 
> my views unless I decompose my model...
> 
> Any other clue ?

So should I fill a ticket or do I make something wrong ?

Regards,
Nicolas


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



Re: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-18 Thread Nicolas Steinmetz

Florian Apolloner a écrit :
> I am not quite sure wheter my answer is correct, as you didn't post
> your view, 

My view is quite simple :

# Display the detail for a given CV
def cv_detail(request, firstname, lastname):
 user = User.objects.get(first_name=firstname, last_name=lastname)
 user_civilstate = user.civilstate_set.all()
 user_summary = user.summary_set.all()
 user_formation = user.formation_set.all()
 user_language = user.language_set.all()
 user_hobby = user.hobby_set.all()
 user_contact = user.contact_set.all()
 user_skill = user.skill_set.all().order_by('domain',)
 user_firm = user.entreprise_set.all().order_by('-start_date',)
 user_experience = user.experience_set.all().order_by('-start_date',)
 user_document = user.document_set.all()
 return render_to_response('cv/cv_detail.html', {'user_civilstate': 
user_civilstate, 'user_summary': user_summary, 'user_formation': 
user_formation, 'user_language': user_language, 'user_hobby': 
user_hobby, 'user_contact': user_contact, 'user_skill': user_skill, 
'user_firm': user_firm, 'user_experience': user_experience, 
'user_document': user_document})
# cv_detail = cache_page(cv_detail, 60 * 60 * 12)

> but I think this is your problem (copy from
> http://www.djangoproject.com/documentation/templates/#regroup):
> Note that {% regroup %} does not work when the list to be grouped is
> not sorted by the key you are grouping by! This means that if your
> list of people was not sorted by gender, you'd need to make sure it is
> sorted before using it, i.e.:
> {% regroup people|dictsort:"gender" by gender as grouped %}

I tried this but the bug persists. Sometimes it works well (technical 
skills are well regrouped by technical domaines) but if I refresh, it's 
no longer the case.

I even tried this on an easier object and it does not work more 
efficiently (user_skill in my view). If I do not add .order_by() in the 
view, and add the |dictsort:"" filter, I have the same bug. If I add the 
order_by() and the dictsort filter, bug remains. It only works well if I 
add the order_by() and remove the dictsort filter.

However for the 1st object on which I had the bug, I cannot sort it in 
my views unless I decompose my model...

Any other clue ?


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



Re: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-17 Thread Florian Apolloner

I am not quite sure wheter my answer is correct, as you didn't post
your view, but I think this is your problem (copy from
http://www.djangoproject.com/documentation/templates/#regroup):
Note that {% regroup %} does not work when the list to be grouped is
not sorted by the key you are grouping by! This means that if your
list of people was not sorted by gender, you'd need to make sure it is
sorted before using it, i.e.:
{% regroup people|dictsort:"gender" by gender as grouped %}

Hope this helps,
Florian Apolloner

On 17 Jun., 16:13, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have the following Model :
>
> class Summary(models.Model):
>  who = models.ForeignKey(User, unique=True, verbose_name='Personne')
>  job_profile = models.CharField('Profil de poste', maxlength=100)
>  summary = models.TextField('Résumé',)
>  intervention_level = models.ManyToManyField(Interventionlevel,
> verbose_name='Niveau d\'intervention', filter_interface=models.HORIZONTAL)
>  expert_domain = models.ManyToManyField(Expertdomain,
> verbose_name='Domaine d\'expertise', filter_interface=models.HORIZONTAL)
>  functionnal_skill = models.ManyToManyField(Funcskill,
> verbose_name='Compétences fonctionnelles',
> filter_interface=models.HORIZONTAL)
>  technical_skill = models.ManyToManyField(Techskill,
> verbose_name='Compétences techniques', filter_interface=models.HORIZONTAL)
>
> and for ex I have :
>
> class Techskill(models.Model):
>  name = models.CharField('Compétences techniques', maxlength=100,
> core=True)
>  domain = models.ForeignKey(DomainTechSkill, verbose_name='Domaine
> de compétences techniques',)
>
> In my template, I use :
>
> {% regroup item.technical_skill.all by domain as grouped %}
> 
>  {% for group in grouped %}
>  {{ group.grouper }} :
> {% for item in group.list %}
> {{ item.name }},
> {% endfor %}
> 
>  {% endfor %}
> 
>
> If I input in the following order (with a domain / name presentation) :
> - Technology : HTML
> - Technology : CSS
> - Webserver : Apache
> - Webserver : Lighttpd
>
> I will have the right order :
> 
>  Technology : HTML, CSS,
>  Webserver : Apache, Lighttpd
> 
>
> but if I had a new technology, like XML, I will have :
>
> 
>  Technology : HTML, CSS,
>  Webserver : Apache, Lighttpd,
>  Technology : XML,
> 
>
> How can I get the correct result which would be :
>
> 
>  Technology : HTML, CSS, XML,
>  Webserver : Apache, Lighttpd,
> 
>
> Regards,
> Nicolas


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