Hi all,

I've asked this question on stackoverflow 
(http://stackoverflow.com/questions/18913661/using-django-relatedfield-for-custom-join-queries),
but figured it might be better to post it here:

I'm curious whether a RelatedField can be used to cause custom join queries.
I would like to apply this in django-parler 
(https://github.com/edoburu/django-parler), a multilingual app for Django.

For example, when "slug" is a translated field, I would like to have:

    MyModel.objects.filter(slug="foo")

to operate as:

    MyModel.objects.fiter(translations__slug="foo")

under the hood. This is possible with the API of the RelatedField class for 
example?

I noticed there are several API hooks in the RelatedField class, such as 
m2m_reverse_field_name(), m2m_target_field_name(), m2m_column_name(), 
extra_filters() etc.. which are used in the GenericRelation and django-taggit's 
TaggableManager classes but I have no idea how these work.

N.B. Regular field access on instances is covered in django-parler (using 
descriptors that proxy to calls to the translated table), and I would love to 
extend support to ORM queries as well.

Best regards,
Diederik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to