akvo.rest.serializers.project_location module

Akvo RSR is covered by the GNU Affero General Public License. See more details in the license.txt file located at the root folder of the Akvo RSR module. For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.

class akvo.rest.serializers.project_location.AdministrativeLocationSerializer(*args, **kwargs)[source]

Bases: BaseRSRSerializer

class Meta[source]

Bases: object

fields = '__all__'
model

alias of AdministrativeLocation

class akvo.rest.serializers.project_location.MapProjectSerializer(*args, **kwargs)[source]

Bases: Serializer

To serialize the project field of the project map resource.

class akvo.rest.serializers.project_location.ProjectLocationCountryNameSerializer(*args, **kwargs)[source]

Bases: Serializer

class Meta[source]

Bases: object

fields = ('country', 'iso_code')
class akvo.rest.serializers.project_location.ProjectLocationExtraSerializer(*args, **kwargs)[source]

Bases: ProjectLocationRawSerializer

class akvo.rest.serializers.project_location.ProjectLocationRawSerializer(*args, **kwargs)[source]

Bases: BaseRSRSerializer

class Meta[source]

Bases: object

fields = '__all__'
model

alias of ProjectLocation

class akvo.rest.serializers.project_location.ProjectLocationSerializer(*args, **kwargs)[source]

Bases: ProjectLocationRawSerializer

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]