This is a bit of a modeling question that I am struggling to get my head around. How would you model this scenario?
I have to record expenses that are of 3 different types. 1. Fixed - The name of the expense and unit amount are fixed. For example, "inconvenience allowance" of £30 per day. 2. Classified - The name of the expense is fixed, but the actual unit amount isn't. For example "Hotel expenses". The actual unit amount will depend on the hotel they stay at. They'll need to enter that themselves. 3. Unclassified - The name of the expense and the amount is arbitrary. So they may have an expense we haven't thought of before but it needs to go in. Of course I'll need to create a summary that tots up the total expenses for the particular event. Would the best way of doing this be: a) Have a base model and then build on that for the 3 different scenarios? b) Have three different tables and then do a union on them? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Just for interest ... this is where I got so far, but am now stumped class CostType(models.Model): name = models.CharField("Name", max_length=30) 'e.g. commission, subsistence ... class CostItem(models.Model): name = models.CharField("Name", max_length=50) 'e.g. product x, inconvenience allowance, ... cost_type = models.ForeignKey(CostType, verbose_name="Type") class Rate(models.Model): cost_item = models.ForeignKey(CostItem, verbose_name="Item") valid_from = models.DateField("From") valid_till = models.DateField("Till") unit_amount = models.DecimalField("Price Per Unit", max_digits=5, decimal_places=2) 'Costs with a fixed description and unit amount class FixedCostList(models.Model): markettingevent= models.ForeignKey(Event) rate = models.ForeignKey(Rate) units = models.IntegerField() 'Costs with a fixed description but arbitrary amount class StructuredCostList(models.Model): markettingevent= models.ForeignKey(Event) cost_item = models.ForeignKey(CostItem, verbose_name="Item") unit_amount = models.DecimalField("Price Per Unit", max_digits=5, decimal_places=2) units = models.IntegerField() 'Costs with both a arbitrary description and amount class OtherCostList(models.Model): markettingevent= models.ForeignKey(Event) description = models.CharField("Name", max_length=30) unit_amount = models.DecimalField("Price Per Unit", max_digits=5, decimal_places=2) units = models.IntegerField() -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.