1
0
mirror of https://github.com/django/django.git synced 2024-11-18 07:26:04 +00:00
django/tests/model_indexes/models.py
Mariusz Felisiak 3297dede7f Fixed #28046 -- Added the db_tablespace parameter to class-based indexes.
Thanks Markus Holtermann and Tim Graham for reviews.
2017-06-27 21:15:15 +02:00

29 lines
689 B
Python

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'])]
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