Hi Dmitriv,

I think you're running into https://code.djangoproject.com/ticket/27332.
Unfortunately this isn't fixed yet, but there's a pull request, so it
might land in 2.0: https://github.com/django/django/pull/7560

Ian

On 21/04/17 19:41, Dmitriy Sintsov wrote:
> If I understand correctly, LEFT JOIN is automatically chosen when
> ForeignKey(null=True) otherwise it will be INNER JOIN?
> 
> My ProfileRequisites.profile ForeignKey is not nullable yet I need to
> use LEFT JOIN in this query so I have profiles and ProfileRequisites in
> the same list. Profiles are always retrieved while ProfileRequisites
> only if these are available (LEFT):
> 
> 
> class ProfileRequisites(models.Model):
> 
>     profile = models.ForeignKey(Profile, related_name='requisites')
>     requisites_type = models.ForeignKey(
>         ContentType, null=True, related_name='related_requisites', 
> verbose_name='Тип реквизитов'
> )
>     requisites_id = models.PositiveIntegerField(verbose_name='Ссылка на 
> реквизиты')
>     requisites_object = GenericForeignKey('requisites_type', 'requisites_id')
>     is_preferred_withdrawal = models.NullBooleanField(default=None, 
> verbose_name='Предпочтительный способ вывода')
> 
> 


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/bda61696-baaa-4640-8523-a7db199951c3%40feete.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to