#13902: When using a ManyToMany in list_filter, results may apper more than once
-------------------------------------------+--------------------------------
Reporter: rasca | Owner: rasca
Status: new | Milestone: 1.3
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords: admin change_list
list_filter manytomany
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
-------------------------------------------+--------------------------------
Comment (by rasca):
I've just uploaded a new patch, not sure if it's correct though.
The problem with the test fail was that the model inherited from another
concrete model and the get_field() returned FieldDoesNotExist. This are
the models from the test:
{{{
class Title(models.Model):
pass
class TitleTranslation(models.Model):
title = models.ForeignKey(Title)
text = models.CharField(max_length=100)
class Recommender(Title):
pass
class Recommendation(Title):
recommender = models.ForeignKey(Recommender)
class RecommendationAdmin(admin.ModelAdmin):
search_fields = ('titletranslation__text',
'recommender__titletranslation__text',)
}}}
What I now did is to use get_field_by_name() and perform and extra check
to see if it's a RelatedObject, in this case
`isinstance(get_field_by_name('titletranslation')[0],
models.related.RelatedObject)`
I'm not familiarized with this part of Django, so I have no idea if what I
did is correct. If it's not, can you give me some pointers please?
--
Ticket URL: <http://code.djangoproject.com/ticket/13902#comment:7>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.