I'm trying out chartdirector and storing chart definitions in a
database.

For you who are not familiar with chartdirector it generates charts by
defining content in layers. The order of the layers determine the
order it is drawn so it is important to get the order right. Now there
are different layers with different properties, but they are all
layers. So how can I use an order field across different tables to
determine the overall order and not just the order in that table?

Can I make it work by using something like this?:

class ChartLayer(models.Model):
   axis  = models.ForeignKey(Chart) #What axis to use
   order = models.IntegerField() #Determines the ordering of layer
   class Meta:
      ordering = ('order')
      abstract = True  #Can I make it work with abstract=True?

class ChartLineLayer(ChartLayer):
   (properties for a line layer)

class ChartBarLayer(ChartLayer):
   (properties for a bar layer)

I guess if I don't use abstract I could hit the database multiple
times by calling first:
ChartLayer.objects.all() #automatic order-by 'order'
and then going through the different layers and storing them in order.
But that feels cumbersome and ugly :)

Would be much nicer if I could join the additional properties and have
them in order directly. Or can someone suggest another design I could
use?

Thanks,
Calle

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to