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

« back to all changes in this revision

Viewing changes to tests/indexes/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 connection
 
2
from django.db import models
 
3
 
 
4
 
 
5
class Article(models.Model):
 
6
    headline = models.CharField(max_length=100)
 
7
    pub_date = models.DateTimeField()
 
8
 
 
9
    class Meta:
 
10
        index_together = [
 
11
            ["headline", "pub_date"],
 
12
        ]
 
13
 
 
14
 
 
15
# Indexing a TextField on Oracle or MySQL results in index creation error.
 
16
if connection.vendor == 'postgresql':
 
17
    class IndexedArticle(models.Model):
 
18
        headline = models.CharField(max_length=100, db_index=True)
 
19
        body = models.TextField(db_index=True)
 
20
        slug = models.CharField(max_length=40, unique=True)