Adding django website.
[pyValueAverager.git] / website / VA / models.py
blob16d98567af1831fbbe78cbaca3ee53ae53792df2
1 from django.db import models
3 class Portfolio(models.Model):
4 name = models.CharField(max_length=200)
5 target = models.IntegerField()
6 target_date = models.DateTimeField('')
8 def __unicode__(self):
9 return u"%s" % (self.name)
11 class Account(models.Model):
12 name = models.CharField(max_length=200)
13 portfolio = models.ForeignKey(Portfolio)
15 def __unicode__(self):
16 return u"%s" % (self.name)
18 class Investment(models.Model):
19 name = models.CharField(max_length=200)
20 ticker = models.CharField(max_length=200)
22 def __unicode__(self):
23 return u"%s" % (self.name)
25 class Position(models.Model):
26 investment = models.ForeignKey(Investment)
27 account = models.ForeignKey(Account)
28 shares = models.FloatField()
30 def __unicode__(self):
31 return u"%s Shares of %s on %s" % (self.shares,
32 self.investment.ticker,
33 self.account)
36 from django.contrib import admin
38 admin.site.register(Portfolio)
39 admin.site.register(Account)
40 admin.site.register(Investment)
41 admin.site.register(Position)