beat.web.search.serializers module

class beat.web.search.serializers.SearchResultSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.Serializer

get_name(obj)[source]
class beat.web.search.serializers.SearchSerializer(*args, **kwargs)[source]

Bases: beat.web.common.serializers.VersionableSerializer

class Meta[source]

Bases: beat.web.common.serializers.Meta

model

alias of beat.web.search.models.Search

default_fields = ['name', 'author', 'user_name', 'is_owner', 'accessibility', 'short_description', 'update_url']
get_user_name(obj)[source]
get_is_owner(obj)[source]
get_accessibility(obj)[source]
get_html_description(obj)[source]
get_update_url(obj)[source]
get_has_leaderboard(obj)[source]
class beat.web.search.serializers.SearchWriteSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of beat.web.search.models.Search

fields = ['name', 'short_description', 'description', 'filters', 'settings', 'leaderboard']
default_fields = []
validate_name(name)[source]
validate(validated_data)[source]
create(validated_data)[source]

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.

update(instance, validated_data)[source]