Monday, August 17, 2015

Re: Django: "Fake" multiple inheritance

Yes, of course you're right James, sorry. My classes are actually named differently and I was just trying to get the idea across.
M

On 17 August 2015 at 22:23, James Schneider <jrschneider83@gmail.com> wrote:


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.



Just to verify, you're not actually inheriting from (object), right? You're using Hotel(models.Model), I hope?

-James 

--
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/CA%2Be%2BciXYQN3%2BwFgm7U3BU17rm5Rw9x-Y7uQ4Whd8Hn%2BgkfjLgA%40mail.gmail.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/CABrKpmCdDs46X33z_0p5wfLOs65TKaAJf4rfSjfyDjgL%2B%2BT1kA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment