1
0
mirror of https://github.com/django/django.git synced 2025-04-01 03:56:42 +00:00
Mariusz Felisiak cee07ba088 [1.11.x] Fixed #28597 -- Fixed crash with the name of a model's autogenerated primary key in an Index's fields.
Backport of fb02ebe889eee292144f9157ed4ddcdcc139eba9 from master
2017-09-18 14:22:33 -04:00

31 lines
696 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')
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