Example #1
0
        class NotExcludingFieldsSearchSet(DjangoSearchSet):
            a = DjangoCharField()
            b = DjangoFloatField(sources=["c"])

            @classmethod
            def _get_raw_mapping(cls):
                return dict(c=DjangoCharField())

            class Meta:
                model = None
Example #2
0
        class ExcludeSourcesInFieldsSearchSet(DjangoSearchSet):
            a = DjangoCharField()
            b = DjangoFloatField(sources=["c"],
                                 exclude_sources_from_mapping=True)

            @classmethod
            def _get_raw_mapping(cls):
                return dict(c=DjangoFloatField())

            class Meta:
                model = None
Example #3
0
        class ExcludeFieldsInClassSearchSet(DjangoSearchSet):
            a = DjangoCharField()
            b = DjangoFloatField(sources=["c"])

            @classmethod
            def _get_raw_mapping(cls):
                return dict(c=DjangoFloatField())

            class Meta:
                model = None
                fields_to_exclude_from_mapping = ["b"]
Example #4
0
class UnicornSearchSet(DjangoSearchSet):
    char_field = DjangoCharField()
    integer_field = DjangoIntegerField()
    float_field = DjangoFloatField()
    boolean_field = DjangoBooleanField()
    field_with_source = DjangoCharField(sources=["ok_it_is_a_source"])
    field_with_several_sources = DjangoCharField(sources=["source1", "source2"])

    @classmethod
    def get_raw_mapping(cls):
        return dict()

    class Meta:
        model = DjangoModel
Example #5
0
        class SearchSet(DjangoSearchSet):
            char_field = DjangoCharField()
            integer_field = DjangoIntegerField(
                sources=["d", "tralala"], exclude_sources_from_mapping=False)
            float_field = DjangoFloatField(sources=["c", "ululu"],
                                           exclude_sources_from_mapping=True)

            @classmethod
            def get_raw_mapping(cls):
                return dict()

            class Meta:
                model = ElasticModel

                fields_to_exclude_from_mapping = ["a", "b"]
Example #6
0
class UnicornSearchSet(DjangoSearchSet):
    char_field = DjangoCharField()
    integer_field = DjangoIntegerField()
    float_field = DjangoFloatField()
    boolean_field = DjangoBooleanField()
    field_with_source = DjangoCharField(sources=["ok_it_is_a_source"])
    field_with_several_sources = DjangoCharField(
        sources=["source1", "source2"])

    @property
    def raw_mapping(self):
        return dict(source1=DjangoCharField(),
                    source2=DjangoCharField(),
                    ok_it_is_a_source=DjangoCharField())

    class Meta:
        model = ElasticModel
Example #7
0
        class SearchSet(DjangoSearchSet):
            char_field = DjangoCharField()
            integer_field = DjangoIntegerField(
                sources=["d", "tralala"], exclude_sources_from_mapping=False)
            float_field = DjangoFloatField(sources=["c", "ululu"],
                                           exclude_sources_from_mapping=True,
                                           show_suggestions=False)

            @classmethod
            def _get_raw_mapping(cls):
                return {"x": None, "y": FieldType.BOOLEAN}

            class Meta:
                model = ElasticModel

                fields_to_exclude_from_mapping = ["x"]
                fields_to_exclude_from_suggestions = ["a", "b"]
Example #8
0
 def _get_raw_mapping(cls):
     return dict(c=DjangoFloatField())