Re: Single table inheritance - working implementation

2012-12-23 Thread Krzysztof Jurewicz
Dnia 2012-12-21, pią o godzinie 11:05 -0800, Anssi Kääriäinen pisze: > I went with a different approach than the patch for 1.5. At this stage > as minimal as possible change to get_default_columns() seemed like a > good idea. See commit a0155f35343afbfd9e98ab9aa4615f06780f697e in > stable/1.5.x. >

Re: Single table inheritance - working implementation

2012-12-21 Thread Anssi Kääriäinen
On 21 joulu, 16:39, Krzysztof Jurewicz wrote: > On 13.12.2012 15:54, Anssi K ri inen wrote: > > > Second, I have created a patch which should allow your work to > > continue working in master. See > >https://github.com/akaariai/django/commit/94c417d2a29a0f72b26019fc38e... > > - the idea is to chan

Re: Single table inheritance - working implementation

2012-12-21 Thread Krzysztof Jurewicz
On 13.12.2012 15:54, Anssi Kääriäinen wrote: Second, I have created a patch which should allow your work to continue working in master. See https://github.com/akaariai/django/commit/94c417d2a29a0f72b26019fc38ef400420097aa4 - the idea is to change get_fields_with_model() so that it doesn't return

Re: Single table inheritance - working implementation

2012-12-13 Thread Anssi Kääriäinen
On 11 joulu, 17:56, Anssi Kääriäinen wrote: > Would a model._meta.get_default_columns() work for you? While this > would still be internal API, it would be hopefully less likely to > change in ways that require extensive rewrites to 3rd party apps. First, the ._meta.get_default_columns() I propos

Re: Single table inheritance - working implementation

2012-12-11 Thread Anssi Kääriäinen
On 7 joulu, 16:18, Krzysztof Jurewicz wrote: > On 29.10.2012 14:34, Krzysztof Jurewicz wrote: > > > In February, Craig de Stigter released django-typed-models > > , > > a package implementing inheritance hierarchy for Proxy mod

Re: Single table inheritance - working implementation

2012-12-07 Thread Krzysztof Jurewicz
On 29.10.2012 14:34, Krzysztof Jurewicz wrote: In February, Craig de Stigter released django-typed-models , a package implementing inheritance hierarchy for Proxy models with automatic type recasting. I've written a fork of it

Re: Single table inheritance - working implementation

2012-10-29 Thread Craig de Stigter
Hi Krzysztof and everyone else Thanks! Your fork looks very promising. I'll review the fork today and possibly pull changes in if the changes aren't too disruptive. Some more tests would probably be good. I've added a New BSD License

Re: Single Table Inheritance

2011-03-30 Thread Alex Robbins
If you need to be able to filter and search across models, you could try haystack. http://docs.haystacksearch.org/dev/searchqueryset_api.html#filter I've setup a site with a real base class, done queries on that and then returned the child classes. It worked, but it felt pretty hacky all the way

Re: Single Table Inheritance

2011-03-30 Thread Forest Bond
Hi Jordan, On Tue, Mar 29, 2011 at 08:40:28AM -0700, Jordan MacDonald wrote: > I'm sure this subject has been beaten to death, but I haven't found an > answer to a simple scenario and I'm wondering why this hasn't been > addressed before. > > I have three models, structured like so: > > Document

Re: Single Table Inheritance

2011-03-29 Thread Johannes Dollinger
Am 29.03.2011 um 20:46 schrieb Shawn Milochik: > They can create a custom manager on the abstract class that would > return an iterable, perhaps using itertools.chain() of the querysets. > > It depends on what they expect to do with the output of this custom > manager, and they'd obviously lose

Re: Single Table Inheritance

2011-03-29 Thread Carl Meyer
On 03/29/2011 02:46 PM, Shawn Milochik wrote: > I'm not proposing a change to Django itself or suggesting that this > should be a standard practice. I do think that this is a fairly clean > solution for an individual to use to solve this problem if they have > it. > > They can create a custom ma

Re: Single Table Inheritance

2011-03-29 Thread Shawn Milochik
On Tue, Mar 29, 2011 at 2:21 PM, Carl Meyer wrote: > Hi Shawn, > > What you've outlined here is certainly possible (and yes, you'd need to > subclass the ModelBase metaclass). I haven't looked at the abstract > inheritance stuff recently, but I think there would be some alternative > ways for the

Re: Single Table Inheritance

2011-03-29 Thread Carl Meyer
Hi Shawn, On 03/29/2011 01:28 PM, Shawn Milochik wrote: > Hopefully someone on the core dev team can let me know if this is > possible in Django. If so, it will solve this problem. > I am not familiar with custom metaclass stuff done within models.Model. > > 1. Create a custom metaclass as descri

Re: Single Table Inheritance

2011-03-29 Thread Jeremy Dunck
On Tue, Mar 29, 2011 at 11:40 AM, Carl Meyer wrote: > On 03/29/2011 12:40 PM, Jeremy Dunck wrote: >> What about keeping abstract inheritance in this case, but allowing >> Document.objects.* to work by returning instances of the subclasses. >> Filtering, etc. would only work based on the Document b

Re: Single Table Inheritance

2011-03-29 Thread Shawn Milochik
Hopefully someone on the core dev team can let me know if this is possible in Django. If so, it will solve this problem. I am not familiar with custom metaclass stuff done within models.Model. 1. Create a custom metaclass as described in "Pro Python," page 124. 2. Add this metaclass to the abstra

Re: Single Table Inheritance

2011-03-29 Thread Jordan MacDonald
Cool. Well, maybe I can look into how abstract base classes are currently implemented and see if there's a way to generate query sets for all derived classes from the parent. Thanks for the insight! On Mar 29, 12:40 pm, Carl Meyer wrote: > On 03/29/2011 12:40 PM, Jeremy Dunck wrote: > > > What

Re: Single Table Inheritance

2011-03-29 Thread Carl Meyer
On 03/29/2011 12:40 PM, Jeremy Dunck wrote: > What about keeping abstract inheritance in this case, but allowing > Document.objects.* to work by returning instances of the subclasses. > Filtering, etc. would only work based on the Document base class. > > It would mean doing some unions, but would

Re: Single Table Inheritance

2011-03-29 Thread Jeremy Dunck
On Tue, Mar 29, 2011 at 11:11 AM, Carl Meyer wrote: > Hi Jordan, > > On 03/29/2011 11:40 AM, Jordan MacDonald wrote: >> I have three models, structured like so: >> >> Document >> -Presentation >> -Spreadsheet ... >> I'd like to be able to write >> Document.objects.all(). I'd then like to be able

Re: Single Table Inheritance

2011-03-29 Thread Carl Meyer
Hi Jordan, On 03/29/2011 11:40 AM, Jordan MacDonald wrote: > I have three models, structured like so: > > Document > -Presentation > -Spreadsheet > > Document is never instantiated on its own; a prime candidate for an > abstract base class. However, there are times where I want to list/ > search