/sphinxtest/tests/models.py

http://django-sphinx.googlecode.com/ · Python · 19 lines · 13 code · 6 blank · 0 comment · 0 complexity · 1b56712fcb15e4de7ab90a5822029815 MD5 · raw file

  1. from django.db import models
  2. from djangosphinx import SphinxSearch
  3. import datetime
  4. class Group(models.Model):
  5. name = models.CharField(max_length=32)
  6. class Document(models.Model):
  7. group = models.ForeignKey(Group)
  8. date_added = models.DateTimeField(default=datetime.datetime.now)
  9. title = models.CharField(max_length=32)
  10. content = models.TextField()
  11. search = SphinxSearch(index="test")
  12. class Meta:
  13. db_table = 'documents'