Monday, August 17, 2015

Re: Django: "Fake" multiple inheritance

Hi gst,

Instead of

    class Hotel(Place):
        ...

I ended up with

    class Hotel(object):
        place = models.OneToOneField(Place, primary_key=True)

I used a OneToOneField instead of ForeignKey because there can only be one hotel in a Place.

M

On 16 August 2015 at 16:22, gst <g.starck@gmail.com> wrote:
Will you care share it?
I found the question interresting..
Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/26Qu9-wJ1gA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dd4e0868-7a69-4d46-87b3-a9b3e153f21d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


Michael Herrmann, MSc
Alser Straße 18/26
1090 Wien
Tel.: +43 699 11 65 16 40

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABrKpmBR1%2BAvK4SkVN23BHFoub4M5Ns0RTGJSE15apMw7p%2BasA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment