Some time ago I proposed a new field type called "CompositeField". It's basicly a way of doing composition in Django models.

Its usage looks like:

    class CoordField(CompositeField):
        x = models.FloatField()
        y = models.FloatField()

    class Place(models.Model):
        name = models.CharField(max_length=10)
        coord = CoordField()

And basicly creates this model:

    class Place(models.Model):
        name = models.CharField(max_length=10)
        coord_x = models.FloatField()
        coord_y = models.FloatField()


Right now the code lives in a scrap heap repository, which is reused in many of the projects I work on. All the stuff is BSD licensed!

https://hg.labs.terreon.de/common/chimes/


It would be nice to get some feedback on this proposal and make it more useful to others. I would like to make a first class project out of it and add the possibility for composite fields to contain other composite fields. Admin integration would be awesome, but I've never really looked into that. The sub fields are normal model fields and can be accessed from queries and admin naturally.


I'll join the sprints on thursday.


--mp

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

Reply via email to