pythondjangodjango-sphinx

where is SeparatedValuesField in my code, i used sphinx


from django.db import models
from djangosphinx import SphinxSearch

# A sample model from iBegin
class City(models.Model):
    name            = models.CharField(max_length=32)
    aliases         = SeparatedValuesField(blank=True, null=True)#<-------this
    slug            = models.SlugField(blank=True)
    country         = models.ForeignKey(Country)
    state           = models.ForeignKey(State, blank=True, null=True)
    listings        = models.PositiveIntegerField(editable=False, default=0)

    latitude        = models.DecimalField(max_digits=9, decimal_places=6, editable=False, default=0, blank=True)
    longitude       = models.DecimalField(max_digits=9, decimal_places=6, editable=False, default=0, blank=True)

    date_added      = CreatedDateTimeField(editable=False)
    date_changed    = ModifiedDateTimeField(editable=False)

    class Meta:
        unique_together = (('country', 'state', 'slug'), ('country', 'state', 'name'))
        db_table = 'cities'

    search = SphinxSearch(
        index='cities', # defaults to cities either way
        weights={ # individual field weighting, this is optional
            'name': 100,
            'aliases': 90,
        }
    )

when i 'python manage.py syncdb'

it print :

  File "D:\zjm_code\sphinx_test\models.py", line 7, in City
    aliases         = SeparatedValuesField(blank=True, null=True)
NameError: name 'SeparatedValuesField' is not defined

what is the SeparatedValuesField ?


Solution

  • It seems to be a user-defined custom form field, one possible definition is on Django Snippets: http://www.djangosnippets.org/snippets/497/

    The blog doesn't seem to be available right now, but perhaps the author has mentioned or used this snippet previously.