Re: subclassing of models

2007-05-23 Thread Atilla

> Given that there is no branch, that statement is incorrect.
>
> Model inheritance is two stations down the line. Unicode gets finished
> first, then query refactor then model inheritance.
>
> Regards,
> Malcolm


Well, I'm certainly  glad to know this. I hadn't checked up on it for
a long time. I'll do my research  better next time.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: subclassing of models

2007-05-23 Thread Atilla

On 23/05/07, OliverMarchand <[EMAIL PROTECTED]> wrote:
>
> Dear Djangos,
>
> Is it possible to subclass a model? This example somehow doesn't work
> for in the sense that I only see the geography on the admin screen.
>
> 
> from django.db import models
>
> class Geography(models.Model):
> name = models.CharField(maxlength=30)
> def __str__(self):
> return self.name
> class Admin:
> pass
>
> class Continent(Geography):
> pass
>
> class Country(Geography):
> continent = models.ForeignKey(Continent)
> ---
>
> Any ideas?
>
> greetings, Oliver
>

Model Inheritance is, sadly, not supported and the branch that
implements that is stalled (or is it ?).

For now  - one of the ways people prefer to do similar things is to
associate entries in the models, via a relationship. You can search
the mailing list archive for different solutions that people have
tried.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



subclassing of models

2007-05-23 Thread OliverMarchand

Dear Djangos,

Is it possible to subclass a model? This example somehow doesn't work
for in the sense that I only see the geography on the admin screen.


from django.db import models

class Geography(models.Model):
name = models.CharField(maxlength=30)
def __str__(self):
return self.name
class Admin:
pass

class Continent(Geography):
pass

class Country(Geography):
continent = models.ForeignKey(Continent)
---

Any ideas?

greetings, Oliver


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: No Subclassing in models yet? How would you guys do the following:

2006-05-10 Thread Jorge Gajon

He is using a common joke found in the slashdot community. See
http://en.wikipedia.org/wiki/Slashdot_culture

But then again, this is not slashdot. So yeah, maybe he was drunk.


On 5/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hmm - were you drunk when you posted this?
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: No Subclassing in models yet? How would you guys do the following:

2006-05-10 Thread [EMAIL PROTECTED]

Hmm - were you drunk when you posted this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: No Subclassing in models yet? How would you guys do the following:

2006-05-10 Thread Carlos Yoder

> Okay point taken - I'll stop trying to be 'elegant' and just live with
> the problem and deal with managing this with a 'VehicleType' model and
> several redundant fields.
>
> It is slightly anoying though!

Annoying? I work on Windows, you insensitive clod!

Cheers,
--
Carlos Yoder
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: No Subclassing in models yet? How would you guys do the following:

2006-05-09 Thread [EMAIL PROTECTED]

> Well, in *that* case: simply make a model based on this table. Or is
> there a problem I don't see?

I think he's looking for something a little more elegant, hence the
inheritance.

> Perhaps you want OneToOne as a simulation of constituent models?  What
> is useful between different kinds of vehicles?  Push that down into a
> Vehicle model and make all specific models of Vehicles (such as Car)
> OneToOne with a Vehicle model?

As someone else noted, the OneToOne docs say that "the semantics of
one-to-one relationships will be changing soon, so we don't recommend
you use them."  Is this sort of thing safe for a project that might be
used for a while?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: No Subclassing in models yet? How would you guys do the following:

2006-05-09 Thread Michael Radziej

[EMAIL PROTECTED] wrote:
> I will say the way I'd be doing the inheritance more simply than is
> suggested on the wiki with one sparse table representing the whole
> inheritance hierarchy.

Well, in *that* case: simply make a model based on this table. Or is
there a problem I don't see?

Michael


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: No Subclassing in models yet? How would you guys do the following:

2006-05-09 Thread Jeremy Dunck

On 5/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> As you can see inheritance would be very very useful for this purpose -
> so maybe I can work on that?

I'm not sure I see that.  I know this is a canonical example of
inheritance, almost as popular as Shape and Square vs. Circle, but
those examples all suck.  :)

Perhaps you want OneToOne as a simulation of constituent models?  What
is useful between different kinds of vehicles?  Push that down into a
Vehicle model and make all specific models of Vehicles (such as Car)
OneToOne with a Vehicle model?

> Even if I got that done it would be nice
> if I could automatically select a slightly different template based on
> the subclass of Vehicle.

So... where do you gain the benefit of polymorphism?  Or is this just
"good design"?

> I will say the way I'd be doing the inheritance more simply than is
> suggested on the wiki with one sparse table representing the whole
> inheritance hierarchy.

...Which supports the idea that OneToOne would do as well.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



No Subclassing in models yet? How would you guys do the following:

2006-05-09 Thread [EMAIL PROTECTED]

I am building a website for a garage to put their cars etc. on.  Said
garage also specialises in second hand vans and on occation trucks, I'd
like to know how I can represent the slightly different forms of data
using django, given that the inheritance is a work in progress and how
I can then display said data in slightly different ways.

As you can see inheritance would be very very useful for this purpose -
so maybe I can work on that?  Even if I got that done it would be nice
if I could automatically select a slightly different template based on
the subclass of Vehicle.

I will say the way I'd be doing the inheritance more simply than is
suggested on the wiki with one sparse table representing the whole
inheritance hierarchy.

See here: http://code.djangoproject.com/wiki/ModelInheritance

Thanks all,

Andy.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---