akvo.rest.serializers.organisation module

class akvo.rest.serializers.organisation.OrganisationBasicSerializer(*args, **kwargs)[source]

Bases: BaseRSRSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'long_name', 'logo')
model

alias of Organisation

class akvo.rest.serializers.organisation.OrganisationExtraSerializer(*args, **kwargs)[source]

Bases: OrganisationSerializer

class Meta[source]

Bases: Meta

fields = ('id', 'logo', 'long_name', 'name', 'primary_location', 'can_edit_users', 'can_create_projects', 'can_create_iati_exports', 'enforce_program_projects', 'content_owner')
get_can_create_iati_exports(organisation)[source]
get_can_create_projects(organisation)[source]
get_can_edit_users(organisation)[source]
class akvo.rest.serializers.organisation.OrganisationSerializer(*args, **kwargs)[source]

Bases: BaseRSRSerializer

class Meta[source]

Bases: object

fields = '__all__'
model

alias of Organisation

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.

get_current_user_permissions(organisation)[source]
class akvo.rest.serializers.organisation.UserManagementOrgSerializer(*args, **kwargs)[source]

Bases: BaseRSRSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'long_name', 'logo', 'can_edit_users')
model

alias of Organisation

get_can_edit_users(organisation)[source]