Re: filter model queryset

66 views
Skip to first unread message

Richard Dahl

unread,
Jun 28, 2012, 7:45:00 PM6/28/12
to django-...@googlegroups.com
This would be done just like any non-MPTT related foreignkey filtering for django: in a ModelForm for the class or ModelAdmin for the class.  Look in the admin documentation for "formfield_for_foreignkey".
-richard



On Jun 26, 2012, at 8:56 AM, Mariano DAngelo wrote:

Hello, I'have a mpttmodel but I want to limit the parent option to root nodes only... is there a way to do that....

parent = TreeForeignKey('self', null=True, blank=True, related_name='children') Instead of pointing to self, I could point to an instance of self, filtered ?

thanks

Reply all
Reply to author
Forward
0 new messages