PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 0ms

/tests/modeltests/expressions/models.py

https://code.google.com/p/mango-py/
Python | 27 lines | 19 code | 5 blank | 3 comment | 0 complexity | ffc6481b63b5a5e2229aa9dd37f233c7 MD5 | raw file
 1"""
 2Tests for F() query expression syntax.
 3"""
 4
 5from django.db import models
 6
 7class Employee(models.Model):
 8    firstname = models.CharField(max_length=50)
 9    lastname = models.CharField(max_length=50)
10
11    def __unicode__(self):
12        return u'%s %s' % (self.firstname, self.lastname)
13
14class Company(models.Model):
15    name = models.CharField(max_length=100)
16    num_employees = models.PositiveIntegerField()
17    num_chairs = models.PositiveIntegerField()
18    ceo = models.ForeignKey(
19        Employee,
20        related_name='company_ceo_set')
21    point_of_contact = models.ForeignKey(
22        Employee,
23        related_name='company_point_of_contact_set',
24        null=True)
25
26    def __unicode__(self):
27        return self.name