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

« back to all changes in this revision

Viewing changes to tests/raw_query/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
from django.db import models
 
2
 
 
3
 
 
4
class Author(models.Model):
 
5
    first_name = models.CharField(max_length=255)
 
6
    last_name = models.CharField(max_length=255)
 
7
    dob = models.DateField()
 
8
 
 
9
    def __init__(self, *args, **kwargs):
 
10
        super(Author, self).__init__(*args, **kwargs)
 
11
        # Protect against annotations being passed to __init__ --
 
12
        # this'll make the test suite get angry if annotations aren't
 
13
        # treated differently than fields.
 
14
        for k in kwargs:
 
15
            assert k in [f.attname for f in self._meta.fields], \
 
16
                "Author.__init__ got an unexpected parameter: %s" % k
 
17
 
 
18
class Book(models.Model):
 
19
    title = models.CharField(max_length=255)
 
20
    author = models.ForeignKey(Author)
 
21
    paperback = models.BooleanField(default=False)
 
22
    opening_line = models.TextField()
 
23
 
 
24
class Coffee(models.Model):
 
25
    brand = models.CharField(max_length=255, db_column="name")
 
26
 
 
27
class Reviewer(models.Model):
 
28
    reviewed = models.ManyToManyField(Book)
 
29
 
 
30
class FriendlyAuthor(Author):
 
31
    pass