Skip to content

Commit

Permalink
Update dosc declared fields (#165)
Browse files Browse the repository at this point in the history
According to v1.8.6 and #139 fields should be changed from serializers.IntegerField()/CharField()... to SerializerMethodField(). Also in get__<...> functions should be added instance arg couse of the DRF documentation.

I just read documentation without looking at the Chanel log and maybe if hadn't looked at the Chanel log after I would spend much more time searching what's wrong.
Please merge this request to avoid similar situations in the future :)
  • Loading branch information
mka142 committed Aug 30, 2021
1 parent 56930cc commit a61aeb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/09_multiple_indexes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ The following example illustrates this usage:
.. code-block:: python
class AggregateSerializer(HaystackSerializer):
extra = serializers.CharField()
_ThingIndex__number = serializers.IntegerField()
extra = serializers.SerializerMethodField()
_ThingIndex__number = serializers.SerializerMethodField()
class Meta:
index_classes = [PersonIndex, PlaceIndex, ThingIndex]
fields = ["firstname", "lastname", "address", "name"]
def get_extra(self):
def get_extra(self,instance):
return "whatever"
def get__ThingIndex__number(self):
def get__ThingIndex__number(self,instance):
return 42
The results of a search might then look like the following:
Expand Down

0 comments on commit a61aeb2

Please sign in to comment.