~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to tests/string_lookup/models.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-11-07 15:33:49 UTC
  • mfrom: (1.3.12)
  • Revision ID: package-import@ubuntu.com-20131107153349-e31sc149l2szs3jb
Tags: 1.6-1
* New upstream version. Closes: #557474, #724637.
* python-django now also suggests the installation of ipython,
  bpython, python-django-doc, and libgdal1.
  Closes: #636511, #686333, #704203
* Set package maintainer to Debian Python Modules Team.
* Bump standards version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
from __future__ import unicode_literals
 
3
 
 
4
from django.db import models
 
5
from django.utils.encoding import python_2_unicode_compatible
 
6
 
 
7
 
 
8
@python_2_unicode_compatible
 
9
class Foo(models.Model):
 
10
    name = models.CharField(max_length=50)
 
11
    friend = models.CharField(max_length=50, blank=True)
 
12
 
 
13
    def __str__(self):
 
14
        return "Foo %s" % self.name
 
15
 
 
16
@python_2_unicode_compatible
 
17
class Bar(models.Model):
 
18
    name = models.CharField(max_length=50)
 
19
    normal = models.ForeignKey(Foo, related_name='normal_foo')
 
20
    fwd = models.ForeignKey("Whiz")
 
21
    back = models.ForeignKey("Foo")
 
22
 
 
23
    def __str__(self):
 
24
        return "Bar %s" % self.place.name
 
25
 
 
26
@python_2_unicode_compatible
 
27
class Whiz(models.Model):
 
28
    name = models.CharField(max_length=50)
 
29
 
 
30
    def __str__(self):
 
31
        return "Whiz %s" % self.name
 
32
 
 
33
@python_2_unicode_compatible
 
34
class Child(models.Model):
 
35
    parent = models.OneToOneField('Base')
 
36
    name = models.CharField(max_length=50)
 
37
 
 
38
    def __str__(self):
 
39
        return "Child %s" % self.name
 
40
 
 
41
@python_2_unicode_compatible
 
42
class Base(models.Model):
 
43
    name = models.CharField(max_length=50)
 
44
 
 
45
    def __str__(self):
 
46
        return "Base %s" % self.name
 
47
 
 
48
@python_2_unicode_compatible
 
49
class Article(models.Model):
 
50
    name = models.CharField(max_length=50)
 
51
    text = models.TextField()
 
52
    submitted_from = models.IPAddressField(blank=True, null=True)
 
53
 
 
54
    def __str__(self):
 
55
        return "Article %s" % self.name