Hi.

I've resolved such a case with two nullable fkeys and a discriminator field
to tell which one fkey is used.

20.10.2017 12.59 "Antonis Christofides" <anto...@djangodeployment.com>
kirjoitti:

Hello,

Two real examples that I've faced:

    class MeteorologicalStation(models.Model):
        ...
        owner = models.ForeignKey(to a person or organization)


    class Document(models.Model):
        ...
        authors = models.ManyToManyKey(to persons or organizations)

What I do is I create a superclass that I call Lentity (short for "legal
entity", despite the fact that it could refer to a group of people and is
not
necessary legal) and the two subclasses Person and Organization, with
multi-table inheritance.

But since I guess that this is a relatively common problem, I was wondering
about what other people are doing.

Thanks!

Antonis

--
Antonis Christofides
http://djangodeployment.com


--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/043cc4db-f1a9-3beb-cf44-f63c401114ac%
40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oczaT5OfJV_biS9XdfNWQuu6Et4cJFZO-7iRXvKAmb1Fw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to