Created
January 29, 2012 04:12
-
-
Save ohbargain/1697118 to your computer and use it in GitHub Desktop.
Django Model Forward Declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Quotations(models.Model): | |
quoted_date = models.DateField(verbose_name="Quoted Date") | |
price = models.FloatField(verbose_name="Quoted Price") | |
machine = models.ForeignKey('Machine', verbose_name = "Associated Machine") | |
def __unicode__(self): | |
return u"%s %s" %(self.machine.name,self.quoted_date,self.price) | |
class Machine(models.Model): | |
name = models.CharField(max_length = 30) | |
manufacturer = models.CharField(max_length = 30) | |
manufactued_date = models.DateTimeField(verbose_name="Date Manufactuered") | |
category = models.ForeignKey(MachineType,verbose_name = "category of machine") | |
quotation = models.ManyToManyField(Quotations,verbose_name="Quotations History") | |
def __unicode__(self): | |
return self.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment