コード例 #1
0
class ModelWithAllDbColumnFields(spx_models.SphinxModel):
    class Meta:
        db_table = 'testapp_testmodel_aliased'
        app_label = 'testapp'

    sphinx_field = spx_models.SphinxField(default='',
                                          db_column='_sphinx_field')
    other_field = spx_models.SphinxField(default='', db_column='_other_field')
    attr_uint = spx_models.SphinxIntegerField(default=0,
                                              db_column='_attr_uint_')
    attr_bigint = spx_models.SphinxBigIntegerField(default=0,
                                                   db_column='_attr_bigint')
    attr_float = models.FloatField(default=0.0, db_column='_attr_float')
    attr_timestamp = spx_models.SphinxDateTimeField(
        default=datetime.now, db_column='_attr_timestamp')
    attr_string = models.CharField(max_length=32,
                                   default='',
                                   db_column='_attr_string')

    attr_multi = spx_models.SphinxMultiField(default=[],
                                             db_column='_attr_multi')
    attr_multi_64 = spx_models.SphinxMulti64Field(default=[],
                                                  db_column='_attr_multi_64')
    attr_json = Django10CompatJSONField(default={}, db_column='_attr_json')
    attr_bool = models.BooleanField(default=False, db_column='_attr_bool')
コード例 #2
0
class FieldMixin(spx_models.SphinxModel):
    class Meta:
        abstract = True

    sphinx_field = spx_models.SphinxField(default='')
    other_field = spx_models.SphinxField(default='')
    attr_uint = spx_models.SphinxIntegerField(default=0,
                                              db_column='attr_uint_')
    attr_bigint = spx_models.SphinxBigIntegerField(default=0)
    attr_float = models.FloatField(default=0.0)
    attr_timestamp = spx_models.SphinxDateTimeField(default=datetime.now)
    attr_string = models.CharField(max_length=32, default='')
    attr_multi = spx_models.SphinxMultiField(default=[])
    attr_multi_64 = spx_models.SphinxMulti64Field(default=[])
    attr_json = Django10CompatJSONField(default={})
    attr_bool = models.BooleanField(default=False)
コード例 #3
0
class OverridenSphinxModel(models.Model, metaclass=sql.SphinxModelBase):
    class Meta:
        managed = False
        app_label = 'testapp'

    _excluded_update_fields = (models.CharField, models.TextField)

    objects = spx_models.SphinxManager()

    sphinx_field = spx_models.SphinxField(default='')
    other_field = spx_models.SphinxField(default='')
    attr_uint = spx_models.SphinxIntegerField(default=0,
                                              db_column='attr_uint_')
    attr_bigint = spx_models.SphinxBigIntegerField(default=0)
    attr_float = models.FloatField(default=0.0)
    attr_timestamp = spx_models.SphinxDateTimeField(default=datetime.now)
    attr_string = models.CharField(max_length=32, default='')
    attr_multi = spx_models.SphinxMultiField(default=[])
    attr_multi_64 = spx_models.SphinxMulti64Field(default=[])
    attr_json = Django10CompatJSONField(default={})
    attr_bool = models.BooleanField(default=False)