As Ryan mentioned. Go through the forms tutorial. Formsets may also help. 
Have a look.


https://docs.djangoproject.com/en/1.9/topics/forms/formsets/




On Monday, 30 May 2016 04:54:16 UTC+5:30, David Zárate wrote:
>
> Hi! I'm making a financial analysis app in Django and to have some data to 
> play with i have to store historical data of balance sheets and profit/loss 
> statements. I need some suggestions on how i can accomplish that.
>
> These are my models so far:
>
> class Entity(models.Model):
> """
> Holds information about entities as banks, finance and insurance companies.
> """
> ENTITY_TYPE = (
> ('BNK', 'Bank'),
> ('FNC', 'Finance'),
> ('INS', 'Insurance'),
> ('UNK', 'Otros'),
> )
> name = models.CharField(max_length=255, unique=True)
> type = models.CharField(choices=ENTITY_TYPE, max_length=3)
>
> def __str__(self):
> return self.name
>
>
> class Statement(models.Model):
> """
> Hold info about a Financial Statement.
> """
> name = models.CharField(max_length=255)
>
> def __str__(self):
> return self.name
>
>
> class AccountGroup(models.Model):
> """
> Model to group accounts together i.e.: Asset, Liability, Equity, Income, 
> Expense
> """
> parent_group = models.ForeignKey('AccountGroup', null=True, blank=True)
> name = models.CharField(max_length=255)
>
> def __str__(self):
> return self.name
>
>
> class Account(models.Model):
> """
> Represents each account of a Financial Statement.
> """
> # TODO this needs to be improved
> order = models.IntegerField(unique=True, default='0000')
> group = models.ForeignKey('AccountGroup')
> name = models.CharField(max_length=255)
>
> def __str__(self):
> return self.name
>
>
> class FinancialStatement(models.Model):
> entity = models.ForeignKey('Entity')
> statement = models.ForeignKey('Statement')
> period = models.DateField()
> accounts = models.ForeignKey('Account', default='0.00')
> amount = models.DecimalField(max_digits=12, decimal_places=2, 
> default='0.00')
>
> def __str__(self):
> return self.entity
>
> Since it's not an accounting app i have to only store data from a monthly 
> statement report, my question here is how can i make a form that brings all 
> accounts for a statement in a column and helps me introduce its 
> corresponding amount in other column. My Account model really needs better 
> logic for the account "order" or "number" part. For comparison purposes 
> every instance of FinancialStatement() needs to hold a date representing 
> the date when the statement was published. And that's my problem. 
>
> Hope you can help me.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4734f2c7-37f8-4eb8-b096-86475d35e8f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to