Re: Template: nested for and ManyToMany field problem - MySQL
> Then you want entry.categories.all in your template. That was the problem. Thanks. -- Adam Hoscilo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Template: nested for and ManyToMany field problem - MySQL
I get this error: len() of unsized object while doing nested for loops in the template: {% for entry in object_list %} {% for category in entry.categories %} {{ category.name }} {% endfor %} {{ entry.get_absolute_url }} {% endfor %} entry.categries is ManyToManyField If i remove the nested for everything works fine. I tried to fetch entries with .select_related() and without - no difference. Database backend is MySQL 5 Anyone had a problem like this one? -- Adam Hoscilo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Custom manager filter by logged in user.
Not that way anymore. I will just check (in the middleware) if the requested entry's author is the logged in user (for edit action) if not throw exception. -- Adam Hoscilo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Custom manager filter by logged in user.
You're right - my fault. It just isn't the way I would like to handle this problem. But I've forgotten about middleware and I think this will be the best way to solve this _issue_ without breaking MVC(MVT) schema (just check if the requested object was created by user). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom manager filter by logged in user.
I would like to filter entries from a logged in user and give him/her the ability to edit them - it would be nice to ensure that scope by manager. As far as I know Models don't have access to request and session data (and I realize it's a MVC/MVT schema violation). Is there any way to manage that by custom managers or maybe some other nice way? PS django.pl coming soon :) -- Regards Adam Hoscilo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---