Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 25, 2011 11:43:44

Euan G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Announcing djeneralize


Hi,

I've recently been working on an open source project to augment the
inheritance of models in Django. This project, called "djeneralize"
allows you to declare specializations on your models and then query
the general case model and get back the specialized instances. A
simple example of the models might be:

class Fruit(BaseGeneralizedModel):
name = models.CharField(max_length=30)

def __unicode__(self):
return self.name

class Apple(Fruit):
radius = models.IntegerField()

class Meta:
specialization = 'apple'

class Banana(Fruit):
curvature = models.DecimalField(max_digits=3, decimal_places=2)

class Meta:
specialization = 'banana'

class Clementine(Fruit):
pips = models.BooleanField(default=True)

class Meta:
specialization = 'clementine'

which then allows the following queries to be executed:

>>> Fruit.objects.all() # what we've got at the moment

>>> Fruit.specializations.all() # the new stuff!


I hope this type of general case/specialization might be of some use
to someone else out there. We're planning on integrating this work in
a large project we're undertaking on content categorization.

Grab the source at github:https://github.com/2degrees/djeneralizeor you can easy_install it (easy_install djeneralize).

Feedback, etc. very welcome.

Thanks, Euan

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 25, 2011 11:50:51

Manoj K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Announcing djeneralize


Hi Euan,
Impressive work.

On Tue, Jan 25, 2011 at 5:13 PM, Euan Goddard <euan.godd...@gmail.com>wrote:

> Hi,
>
> I've recently been working on an open source project to augment the
> inheritance of models in Django. This project, called "djeneralize"
> allows you to declare specializations on your models and then query
> the general case model and get back the specialized instances. A
> simple example of the models might be:
>
> class Fruit(BaseGeneralizedModel):
> name = models.CharField(max_length=30)
>
> def __unicode__(self):
> return self.name
>
> class Apple(Fruit):
> radius = models.IntegerField()
>
> class Meta:
> specialization = 'apple'
>
> class Banana(Fruit):
> curvature = models.DecimalField(max_digits=3, decimal_places=2)
>
> class Meta:
> specialization = 'banana'
>
> class Clementine(Fruit):
> pips = models.BooleanField(default=True)
>
> class Meta:
> specialization = 'clementine'
>
> which then allows the following queries to be executed:
>
> >>> Fruit.objects.all() # what we've got at the moment
>
> >>> Fruit.specializations.all() # the new stuff!
>
>
> I hope this type of general case/specialization might be of some use
> to someone else out there. We're planning on integrating this work in
> a large project we're undertaking on content categorization.
>
> Grab the source at github:https://github.com/2degrees/djeneralize>
> or you can easy_install it (easy_install djeneralize).
>
> Feedback, etc. very welcome.
>
> Thanks, Euan
>
> --
> 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
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>


--
Thanks & Regards

*Manoj Kumar*
*
*

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 25, 2011 14:26:28

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Announcing djeneralize


On Tue, Jan 25, 2011 at 11:43 AM, Euan Goddard <euan.godd...@gmail.com> wrote:
> Hi,
>
> I've recently been working on an open source project to augment the
> inheritance of models in Django. This project, called "djeneralize"
> allows you to declare specializations on your models and then query
> the general case model and get back the specialized instances. A
> simple example of the models might be:
>

Hi Euan, sounds good.

Had you come across django_polymorphic? This library also covers
similar goals.

Cheers

Tom

http://bserve.webhop.org/django_polymorphic/--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 25, 2011 14:49:28

Euan G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Announcing djeneralize


Hi Tom,

I hadn't seen that. django_polymorphic looks pretty fully featured and
from a quick look, I'd say it accomplishes everything we set out to
do. I guess a use case for djeneralize would be to handle the simple
specializations and generalizations and nothing more. The impetuous to
write the package was just to augment Django's model inheritance which
did almost everything we needed.

Thanks again for the link.

Euan

On Jan 25, 2:26 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Tue, Jan 25, 2011 at 11:43 AM, Euan Goddard <euan.godd...@gmail.com> wrote:
> > Hi,
>
> > I've recently been working on an open source project to augment the
> > inheritance of models in Django. This project, called "djeneralize"
> > allows you to declare specializations on your models and then query
> > the general case model and get back the specialized instances. A
> > simple example of the models might be:
>
> Hi Euan, sounds good.
>
> Had you come across django_polymorphic? This library also covers
> similar goals.
>
> Cheers
>
> Tom
>
> http://bserve.webhop.org/django_polymorphic/--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 25, 2011 16:08:20

sebastien p.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Announcing djeneralize


Great packages ...

I was looking for something exactly similar for a project I am working
on. I will surely use one of those !


On Jan 25, 4:49 pm, Euan Goddard <euan.godd...@gmail.com> wrote:
> Hi Tom,
>
> I hadn't seen that. django_polymorphic looks pretty fully featured and
> from a quick look, I'd say it accomplishes everything we set out to
> do. I guess a use case for djeneralize would be to handle the simple
> specializations and generalizations and nothing more. The impetuous to
> write the package was just to augment Django's model inheritance which
> did almost everything we needed.
>
> Thanks again for the link.
>
> Euan
>
> On Jan 25, 2:26 pm, Tom Evans <tevans...@googlemail.com> wrote:
>
> > On Tue, Jan 25, 2011 at 11:43 AM, Euan Goddard <euan.godd...@gmail.com>
> > wrote:
> > > Hi,
>
> > > I've recently been working on an open source project to augment the
> > > inheritance of models in Django. This project, called "djeneralize"
> > > allows you to declare specializations on your models and then query
> > > the general case model and get back the specialized instances. A
> > > simple example of the models might be:
>
> > Hi Euan, sounds good.
>
> > Had you come across django_polymorphic? This library also covers
> > similar goals.
>
> > Cheers
>
> > Tom
>
> > http://bserve.webhop.org/django_polymorphic/--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 12th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support