On Sun, May 29, 2016 at 02:22:48PM -0700, 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.



When you say "form", do you mean a Django Form[1]?



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



> 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 [email protected].
To post to this group, send email to [email protected].
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/20160531132206.GB10405%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to