I'm working on a project where I've identified the following classes:

class FiscalYear(models.Model):
    fyear = models.CharField(max_length=6, unique=True)
    startdate = models.DateField()
    enddate = models.DateField()

class System(models.Model):
    system_number = models.CharField(max_length=4, unique=True)
    system_name = models.CharField(max_length=30, unique=True)
    description = models.TextField()

class Account(models.Model):
    account_number = models.CharField(max_length=6, unique=True)
    account_name = models.CharField(max_length=30, unique=True)

For each fiscal year, we want to assign accounts to a System.
Accounts and Systems have a many to many relationship, but I'm getting
hung up on the fiscal year part of it which prevents me from just
adding account to my System class and using models.ManyToManyField()
for it.  Plus I've got a charge pct. that has to be included as well.
Right now, this is the best I've come up with:

class SystemCharge(models.Model):
    fyear = models.ForeignKey(FiscalYear)
    system = models.ForeignKey(System)
    account = models.ForeignKey(Account)
    charge_pct = models.DecimalField(max_digits=4, decimal_places=1)

For each system, the total of the charge pct's must be equal to 100.
For example, for System A, we want to charge 75% of all time billed to
Account 123456 and we want to charge the remaining 25% of all time
billed to Account 111111.

Is there a better way to create the class or classes for the
SystemCharge?
--~--~---------~--~----~------------~-------~--~----~
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