> > additional to this the categories per video need to be detailed as well > (category the video belongs to is a ManyToMany) >
If i understand you correctly then If you want some aditional information to be putted on the ManyToMany relationship then u need to use "through" parametr and one more table. look in docs. > > so my question is how to I order the query set by a foreign key that has a > function to get the surname and also output on the template all the > categories that the video belongs to? > > > To get all categories of the Video item u can do: video.category.all() About your wish to use method of get_surname to sort queryst - i think it's not possible to do in this ORM.(well, i'll be happy if im wrong) But you can sort queryset after you get it or you could subclass models.query.QuerySet to add you own functionality like Item.objects.filter(...).order_by_surname(item.get_surname()) or smth like this -- *Vovk Donets* python/django developer skype: suunbeeam icq: 232490857 mail: donets.vladi...@gmail.com www: vovk.org.ru -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.