You're absolutely right, I could simply compute those values as
required. I also confess to not having very much dbase design
experience so your commentary is valuable. My question was also partly
motivated by the documentation on the _pre_save method, which seemed to
suggest it might serve my purpose.

My motivation here is there are tables other than Reimburse that will
do very similar things, but require some unique attributes. So I was
looking for a way to assess expenditures in one place, rather than
inspecting multiple tables. Of course I realise common things like
count and price belong in expenditures, bit I'm still faced with the
issue of needing to associate that expenditure with an Account. And
that means if I want to determine the status of an account I need to
look at all tables in which expenditures are being made.

Modifying Russell's model, I'll add a Order table and put price and
count into Expenditure:

-- model --

class Account(Model):
   owner = CharField()

class Order(Model):
    catalogid = IntegerField()
    vendor = CharField()
    account = ForeignKey(Account)
    expenditure = ForeignKey(Expenditure) # diff

class Reimburse(Model):
    account = ForeignKey(Account)
    reimburse_for = CharField()
    expenditure = ForeignKey(Expenditure) # diff

class Expenditure(Model):
    price = FloatField()
    count = IntegerField()
    account = ForeignKey(Account)

I can compute these values by inspecting both the Orders and Reimburse
tables. Is that the best way?

Comments appreciated.


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

Reply via email to