Re: type-field model inheritance

2011-03-04 Thread Craig de Stigter
Since multi-table-inheritance is the only kind of inheritance (apart from abstract/proxy) supported by Django's ORM, I don't know what other type of inheritance django_polymorphic would be referring to... As per my original post, I want to store everything in one table (all subclasses have t

Re: type-field model inheritance

2011-03-04 Thread Simon Meers
Hi Carl, > FWIW, django-model-utils [1] includes an InheritanceManager that > implements polymorphic queries in a single query via select_related. Ah, there goes my theory that I thought of it first :) And of course introspection of subclasses via the reverse OneToOne descriptors is perfect. --

Re: type-field model inheritance

2011-03-04 Thread Carl Meyer
Hi Simon, On Mar 4, 3:27 am, Simon Meers wrote: > +1 for better polymorphic support in Django core; it is a very common > problem which could do with an efficient and elegant solution. > Regarding efficiency, if you can keep track of your subclasses > effectively (potentially using a registry if

Re: type-field model inheritance

2011-03-04 Thread Carl Meyer
Hi Craig, On Mar 4, 1:03 am, Craig de Stigter wrote: > It looks like django_polymorphic does what I want. I'm not yet sure why it > says it takes one query per type of model in a queryset. Unless it is > talking about multi-table inheritance, in which each type would require a > different join. B

Re: type-field model inheritance

2011-03-04 Thread Simon Meers
On 4 March 2011 17:03, Craig de Stigter wrote: > Hi guys > > Thanks for pointing those out. I knew I couldn't have been the first to want > this. I guess I just didn't know the right words to search for here. > It looks like django_polymorphic does what I want. I'm not yet sure why it > says it ta

Re: type-field model inheritance

2011-03-03 Thread Craig de Stigter
Hi guys Thanks for pointing those out. I knew I couldn't have been the first to want this. I guess I just didn't know the right words to search for here. It looks like django_polymorphic does what I want. I'm not yet sure why it says it takes one query per type of model in a queryset. Unless it

Re: type-field model inheritance

2011-03-03 Thread Russell Keith-Magee
On Thu, Mar 3, 2011 at 10:07 AM, Craig de Stigter wrote: > I realise everyone's been busy with getting 1.3 ready, but doesn't anyone > have thoughts on this? It's been two weeks ... Hi Craig, Thanks for the suggestion. As you've noted, we've been busy with the 1.3 release, which has been consumi

Re: type-field model inheritance

2011-03-02 Thread Stephen Burrows
It sounds like you want to make polymorphic models - queries that retrieve various types of objects. There's an implementation of this: https://github.com/bconstantin/django_polymorphic On Mar 2, 9:07 pm, Craig de Stigter wrote: > I realise everyone's been busy with getting 1.3 ready, but doesn't

Re: type-field model inheritance

2011-03-02 Thread Craig de Stigter
I realise everyone's been busy with getting 1.3 ready, but doesn't anyone have thoughts on this? It's been two weeks ... Thanks Craig On Thursday, February 17, 2011 11:08:57 PM UTC+13, Craig de Stigter wrote: > > Hi folks > > Ever since Django started supporting various types of model inheritanc

type-field model inheritance

2011-02-17 Thread Craig de Stigter
Hi folks Ever since Django started supporting various types of model inheritance I've wondered why it lacks the kind that I would find most useful: python behaviour differentiated based on the value of a field. I'll explain with an example. Here's what I'd like to do: class Datasource(models.M