PageRenderTime 31ms CodeModel.GetById 12ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

/tests/regressiontests/string_lookup/models.py

https://code.google.com/p/mango-py/
Python | 45 lines | 32 code | 12 blank | 1 comment | 0 complexity | db8e2b6d6757576557ca18276eaf2a65 MD5 | raw file
 1# -*- coding: utf-8 -*-
 2from django.db import models
 3
 4class Foo(models.Model):
 5    name = models.CharField(max_length=50)
 6    friend = models.CharField(max_length=50, blank=True)
 7
 8    def __unicode__(self):
 9        return "Foo %s" % self.name
10
11class Bar(models.Model):
12    name = models.CharField(max_length=50)
13    normal = models.ForeignKey(Foo, related_name='normal_foo')
14    fwd = models.ForeignKey("Whiz")
15    back = models.ForeignKey("Foo")
16
17    def __unicode__(self):
18        return "Bar %s" % self.place.name
19
20class Whiz(models.Model):
21    name = models.CharField(max_length=50)
22
23    def __unicode__(self):
24        return "Whiz %s" % self.name
25
26class Child(models.Model):
27    parent = models.OneToOneField('Base')
28    name = models.CharField(max_length=50)
29
30    def __unicode__(self):
31        return "Child %s" % self.name
32
33class Base(models.Model):
34    name = models.CharField(max_length=50)
35
36    def __unicode__(self):
37        return "Base %s" % self.name
38
39class Article(models.Model):
40    name = models.CharField(max_length=50)
41    text = models.TextField()
42    submitted_from = models.IPAddressField(blank=True, null=True)
43
44    def __str__(self):
45        return "Article %s" % self.name