Re: Inheritance question: Multiple roles for users

2013-04-18 Thread M Hill
> > Model inheritance is not the same as object inheritance. > > If you are doing non abstract inheritance, then there is no difference > between a derived model, and a model that has a foreign key to the > parent class. In a derived model, the foreign key is a OneToOneField, > with

Re: Inheritance question: Multiple roles for users

2013-04-18 Thread Tom Evans
On Thu, Apr 18, 2013 at 5:11 AM, M Hill wrote: > I've searched this group for threads related to multitable inheritance. The > one most similar to my query so far was titled "multiple children in > multitable inheritance", from Apr. 2008. Like the original poster, I'd >

Inheritance question: Multiple roles for users

2013-04-18 Thread M Hill
I've searched this group for threads related to multitable inheritance. The one most similar to my query so far was titled "multiple children in multitable inheritance", from Apr. 2008. Like the original poster, I'd thought of Bar as a possible subclass of Place, which might share the same

Re: Model Class Inheritance question

2009-10-10 Thread Jani Tiainen
whiskeyjuvenile kirjoitti: > I'm making some sort of galactic map with the following classes > defined in models.py: > > class Star(models.Model): > name = models.CharField(max_length=200) > xcoord = models.FloatField() > ycoord = models.FloatField() > zcoord =

Re: Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
class Planet(Satellite): orbital = models.IntegerField() orbits = models.ForeignKey(Star, related_name='planets') def save(self): self.orbits = self.star super(Planet, self).save() This works, although it seems really inelegant due to duplicating data in Planet.orbits

Re: Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
I was thinking, alternatively, in Planet: orbits = models.ForeignKey(System, related_name='planets') def __init__(self, *args, **kwargs): super(Planet, self).__init__(*args, **kwargs) orbits = system --~--~-~--~~~---~--~~ You received this

Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
I'm making some sort of galactic map with the following classes defined in models.py: class Star(models.Model): name = models.CharField(max_length=200) xcoord = models.FloatField() ycoord = models.FloatField() zcoord = models.FloatField() def __unicode__(self): return

Model Inheritance question

2009-06-25 Thread LeeRisq
If I am looking to use an abstract base class with multiple models, which is assigned the primary key id? The child or the parent? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Inheritance question

2009-01-05 Thread carlopires
Ok looks reazonable. But be something like: p = Person(name='test') s = Student(person=p, course='test course') or s = Student(parent=p) is desirable and easy to implement a copy data from Person instance to Student. On Jan 3, 1:02 am, Malcolm Tredinnick wrote: >

Re: Inheritance question

2009-01-02 Thread Malcolm Tredinnick
On Fri, 2009-01-02 at 16:29 -0800, carlopires wrote: > Hi, > > I'm trying Multi Table Inheritance with: > > class Person(models.Model): >name = CharField(max_length=30) > > class Student(Person): >course = CharField(max_length=30) > > on db shell: > > p = Person(name='Carlo') >

Inheritance question

2009-01-02 Thread carlopires
Hi, I'm trying Multi Table Inheritance with: class Person(models.Model): name = CharField(max_length=30) class Student(Person): course = CharField(max_length=30) on db shell: p = Person(name='Carlo') p.save() Why I can't: s = Student(p) s.save() ? How Can I evolute a Person to

Re: Model inheritance question

2008-11-02 Thread felix
see also this: http://www.djangosnippets.org/snippets/1031/ for a tumblelog I have been actually fetching queries for each item type, concatenating them as lists, then sorting by date. that's much simpler since its usually mostly display. I mostly use model inheritance in situations where I need

Re: Model inheritance question

2008-11-02 Thread Ramiro Morales
On Sun, Nov 2, 2008 at 4:52 AM, void <[EMAIL PROTECTED]> wrote: > > Can someone point to the correct way to do this? > > Suppose i'm working in a tumblelog, it's basically , 4 o 5 tipes of > "post item" that share some cmmon information. > > So the first approach i would go is: > > cllass

Model inheritance question

2008-11-02 Thread void
Can someone point to the correct way to do this? Suppose i'm working in a tumblelog, it's basically , 4 o 5 tipes of "post item" that share some cmmon information. So the first approach i would go is: cllass Post(models.Model): here goes common metada of all things that can be "posted" like

Re: Template Inheritance Question

2008-09-19 Thread djandrow
Its shared hosting so it could just be the file editor (which is built in) that they use causing it to happen if this doesn't happen to anyone else. If no one else is having the problem I would imangine that would be it. Thanks, Andrew --~--~-~--~~~---~--~~ You

Re: Template Inheritance Question

2008-09-19 Thread Matthias Kestenholz
On Sat, Sep 20, 2008 at 12:08 AM, David Durham, Jr. <[EMAIL PROTECTED]> wrote: > > On Fri, Sep 19, 2008 at 4:07 PM, djandrow <[EMAIL PROTECTED]> wrote: >> >> I have a template, text that extend a template base. >> >> In my text template I have; >> >> {% extends 'base.html' %} >> >> {% block

Re: Template Inheritance Question

2008-09-19 Thread David Durham, Jr.
On Fri, Sep 19, 2008 at 4:07 PM, djandrow <[EMAIL PROTECTED]> wrote: > > I have a template, text that extend a template base. > > In my text template I have; > > {% extends 'base.html' %} > > {% block content %} > > SOME CODE > > {% endblock content %} I'm not a django expert, but I think that

Template Inheritance Question

2008-09-19 Thread djandrow
I have a template, text that extend a template base. In my text template I have; {% extends 'base.html' %} {% block content %} SOME CODE {% endblock content %} Anyway, my question is when I enter this save it then stick it on my server, it adds closing tags at the bottom; and the Doctype

Re: Basic template inheritance question

2008-09-18 Thread Kenneth Gonsalves
On Thursday 18 Sep 2008 3:53:48 pm Daniele Procida wrote: >   {% block stylesheets %}{% endblock %} > > in the head, and place the stylesheets in a block in a template that > extends base.html. At any rate, this is what I gathered was the way to > do this. that is the way everyone does it - so

Re: Basic template inheritance question

2008-09-18 Thread akonsu
wow, my thread has been hijacked :) thanks to those who replied to my original question. konstantin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Basic template inheritance question

2008-09-18 Thread Daniele Procida
On Thu, Sep 18, 2008, Daniel Roseman <[EMAIL PROTECTED]> wrote: > >On Sep 18, 11:23 am, "Daniele Procida" <[EMAIL PROTECTED]> >wrote: >> Maybe if I explain what I'm doing it will help. >> >> Django CMS uses a base template, base.html. base.html is: >> >>

Re: Basic template inheritance question

2008-09-18 Thread Daniel Roseman
On Sep 18, 11:23 am, "Daniele Procida" <[EMAIL PROTECTED]> wrote: > Maybe if I explain what I'm doing it will help. > > Django CMS uses a base template, base.html. base.html is: > > > > What I would like is to devolve bits

Re: Basic template inheritance question

2008-09-18 Thread Daniele Procida
On Thu, Sep 18, 2008, Daniel Roseman <[EMAIL PROTECTED]> wrote: >> >> I have a base.html template. >> >> >> In it I've inserted: >> >> >>     {% block stylesheets %}{% endblock %} >> >> >> and in stylesheets.html in the same directory: >> >> >>     {% extends "base.html" %} >> >>         {%

Re: Basic template inheritance question

2008-09-18 Thread Daniel Roseman
On Sep 18, 9:48 am, "Daniele Procida" <[EMAIL PROTECTED]> wrote: > On Thu, Sep 18, 2008, Daniel Roseman <[EMAIL PROTECTED]> wrote: > >On Sep 18, 8:50 am, "Daniele Procida" <[EMAIL PROTECTED]> > >wrote: > >> I have a base.html template. > > >> In it I've inserted: > > >>     {% block stylesheets

Re: Basic template inheritance question

2008-09-18 Thread Kenneth Gonsalves
On Thursday 18 Sep 2008 1:20:55 pm Daniele Procida wrote: >     {% extends "base.html" %} >         {% block stylesheets %} >             <--- my styles ---> >         {% endblock %} > > But the {% block stylesheets %} in stylesheets.html isn't filling in the > block in base.html - obviously I'm

Re: Basic template inheritance question

2008-09-18 Thread Daniele Procida
On Thu, Sep 18, 2008, Daniel Roseman <[EMAIL PROTECTED]> wrote: >On Sep 18, 8:50 am, "Daniele Procida" <[EMAIL PROTECTED]> >wrote: >> I have a base.html template. >> >> In it I've inserted: >> >>     {% block stylesheets %}{% endblock %} >> >> and in stylesheets.html in the same directory: >> >>

Re: Basic template inheritance question

2008-09-18 Thread Daniel Roseman
On Sep 18, 8:50 am, "Daniele Procida" <[EMAIL PROTECTED]> wrote: > I have a base.html template. > > In it I've inserted: > >     {% block stylesheets %}{% endblock %} > > and in stylesheets.html in the same directory: > >     {% extends "base.html" %} >         {% block stylesheets %} >          

Basic template inheritance question

2008-09-18 Thread Daniele Procida
I have a base.html template. In it I've inserted: {% block stylesheets %}{% endblock %} and in stylesheets.html in the same directory: {% extends "base.html" %} {% block stylesheets %} <--- my styles ---> {% endblock %} But the {% block stylesheets %} in

Multi-Table Inheritance Question

2008-06-06 Thread saxon75
I'm kind of new to both Django and Python, so bear with me if the answer here is really obvious. I'm working on a blog/CMS project wherein I want to have different types of posts--for example, normal articles, film reviews, book reviews, etc.--where each type of post will have certain common

Poor man's model inheritance question.

2006-10-31 Thread medhat
Hi, I am using OneToOneField to simulate model inheritance. I have all the shared fields in a base model, and then for every specific case I have a derived model that has a OneToOneField to that base model. That was all working fine. Recently I was trying to encapsulate some of the