1 | def lookup_allowed(self, lookup):
|
---|
2 | allowed = super(admin.ModelAdmin, self).lookup_allowed(lookup)
|
---|
3 | if not allowed:
|
---|
4 | from django.db.models.sql.constants import LOOKUP_SEP, QUERY_TERMS
|
---|
5 |
|
---|
6 | parts = lookup.split(LOOKUP_SEP)
|
---|
7 |
|
---|
8 | # Last term in lookup is a query term (__exact, __startswith etc)
|
---|
9 | # This term can be ignored.
|
---|
10 | if len(parts) > 1 and parts[-1] in QUERY_TERMS:
|
---|
11 | parts.pop()
|
---|
12 | clean_lookup = LOOKUP_SEP.join(parts)
|
---|
13 | if clean_lookup == "medewerker__user_ptr":
|
---|
14 | allowed = True
|
---|
15 |
|
---|
16 | return allowed
|
---|