Hi all,

I have an app for storing historical data for stocks, which I
automatically fetch on a daily basis from Yahoo using the exellent
matplotlib. I have split this into two models, something like this:

class Stock(models.Model):
     ticker=models.CharField(max_length=30)
     name=models.CharField(max_length=255)

class Quote(models.Model):
     stock=models.ForeignKey(Stock)
     date=models.DateField()
     open=models.FloatField()
     ......

Quotes are naturally unique for dates so I would like to use the date-
field as a primary key. However, if I use the date-field as a primary
key only the quotes-values for the latest stock in my list of stocks
are kept - all others are over-written.

Would it be more appropriate to substitute the ForeignKey with a
ManyToMany-field and use a primary key for the date-field? Any other
suggestions?

Thanks for any pointers!

Stale

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to