#23351: Admin Search Field error for related lookup
-------------------------------------+-------------------------------------
Reporter: ebertti | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 1.7-rc-2
(models, ORM) | Resolution:
Severity: Release blocker | worksforme
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by pfif):
* cc: florent.pastor@… (added)
Comment:
I have a similar issue, except that my model is slightly more complex. The
{{{Module}}} class inherit from another one, and I use a
{{{ManyToManyField}}}, instead of a {{{ForeignKey}}}.
{{{
class Base(models.Model):
name = models.CharField(max_length=100)
class Module(Base):
pass
class Subject(models.Model):
module = models.ManyToManyField(Module)
}}}
The admin class is still the same :
{{{
class SubjectAdmin(admin.ModelAdmin):
search_fields = ('module__name',)
}}}
When I try to search, I get this issue :
{{{
Django Version: 1.6.5
Exception Type: TypeError
Exception Value:
Related Field got invalid lookup: icontains
Exception Location: /usr/local/lib/python2.7/dist-
packages/django/db/models/fields/related.py in get_lookup_constraint, line
1123
Python Executable: /usr/bin/python
Python Version: 2.7.6
}}}
By the way, I run Django 1.6.5, I did not test my project under django
1.7.
--
Ticket URL: <https://code.djangoproject.com/ticket/23351#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.92b03bf82b7ba68b373deb1f72052054%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.