-
Notifications
You must be signed in to change notification settings - Fork 211
Closed
Description
The complier throws an error when there are two chained identical filters. The case that brought me to find this was when I creating a form for the admin.
I have the following line of code:
self.fields['faculty'].queryset = User.objects.filter(pk__in = [faculty.user.pk for faculty in faculty_list])
In the case where there is only one faculty user, and I create the object (in the admin form) selecting that one user, I will get an error triggered by the following line of django_mongodb_engine/compiler.py
on line 245:
assert all(key not in existing for key in lookup.keys()), [lookup, existing]
What is causing this case to occur is the following code in the clean() method of Django's ModelChoiceField
qs = self.queryset.filter(**{'%s__in' % key: value})
where the value is the choice I selected.
Puting both of these together you get the query
User.objects.filter(pk__in = [u'4eaef5d7bb6933592e000010']).filter(pk__in = [u'4eaef5d7bb6933592e000010'])
and then the AssertionError
triggers.
I'm trying to work on a patch right now, but I'm not real familiar with the complier. Any advice appreciated.
Metadata
Metadata
Assignees
Labels
No labels