File: models.py

package info (click to toggle)
django-ajax-selects 1.7.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 356 kB
  • sloc: python: 924; javascript: 191; makefile: 4
file content (43 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

from django.db import models


class Person(models.Model):

    name = models.CharField(max_length=50)
    email = models.EmailField(null=True, blank=True)

    class Meta:
        app_label = 'tests'


class PersonWithTitle(Person):

    """
    Testing an inherited model (multi-table)
    """

    title = models.CharField(max_length=150)

    class Meta:
        app_label = 'tests'


class Author(models.Model):

    name = models.CharField(max_length=50)

    class Meta:
        app_label = 'tests'


class Book(models.Model):

    """ Book has no admin, its an inline in the Author admin"""

    author = models.ForeignKey(Author, null=True, on_delete=models.CASCADE)
    name = models.CharField(max_length=50)
    mentions_persons = models.ManyToManyField(Person, help_text="MENTIONS PERSONS HELP TEXT")

    class Meta:
        app_label = 'tests'