Re: Django: "Fake" multiple inheritance

2015-08-17 Thread James Schneider
Just making sure. Good luck! -James On Aug 17, 2015 1:25 PM, "Michael Herrmann" wrote: > 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 > wrote: > >> >> >> Hi

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread Michael Herrmann
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 wrote: > > > Hi gst, >> >> Instead of >> >> class Hotel(Place): >> ... >> >> I ended up with >> >> class

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread James Schneider
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,

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread Michael Herrmann
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 wrote:

Re: Django: "Fake" multiple inheritance

2015-08-16 Thread gst
Will you care share it? I found the question interresting.. Thanks. -- 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. T

Re: Django: "Fake" multiple inheritance

2015-08-16 Thread Michael Herrmann
Thank you Daniel, I found another way. Best, Michael On 14 August 2015 at 23:17, Daniel H wrote: > Hi Michael. > > First of all, setting the pk to the pk of a different model will do > nothing. > > You can do this however, using Foreign Keys >

Re: Django: "Fake" multiple inheritance

2015-08-14 Thread Daniel H
Hi Michael. First of all, setting the pk to the pk of a different model will do nothing. You can do this however, using Foreign Keys restaurant = models.ForeignKey('Restautant') Then declare a new hotel obje

Django: "Fake" multiple inheritance

2015-08-14 Thread michael
Hi all, suppose I have the following model structure from django.db import models class Place(models.Model): name = models.CharField(max_length=50) class Restaurant(Place): ... class Hotel(Place): ... I already have a Restaurant in my databa