File: models.py

package info (click to toggle)
python-django 2%3A2.2.28-1~deb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 52,468 kB
  • sloc: python: 235,755; javascript: 19,226; xml: 201; makefile: 175; sh: 43
file content (31 lines) | stat: -rw-r--r-- 769 bytes parent folder | download
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
from django.db import models


class Book(models.Model):
    title = models.CharField(max_length=50)
    author = models.CharField(max_length=50)
    pages = models.IntegerField(db_column='page_count')
    shortcut = models.CharField(max_length=50, db_tablespace='idx_tbls')
    isbn = models.CharField(max_length=50, db_tablespace='idx_tbls')

    class Meta:
        indexes = [
            models.indexes.Index(fields=['title']),
            models.indexes.Index(fields=['isbn', 'id']),
        ]


class AbstractModel(models.Model):
    name = models.CharField(max_length=50)

    class Meta:
        abstract = True
        indexes = [models.indexes.Index(fields=['name'])]


class ChildModel1(AbstractModel):
    pass


class ChildModel2(AbstractModel):
    pass