akvo.rest.serializers.project_update 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_update.ProjectUpdateDeepSerializer(*args, **kwargs)[source]
Bases:
ProjectUpdateSerializer
Deep serializer for project updates.
- class akvo.rest.serializers.project_update.ProjectUpdateExtraSerializer(*args, **kwargs)[source]
Bases:
BaseRSRSerializer
This serializer includes data about user and connected organisation.
- class akvo.rest.serializers.project_update.ProjectUpdatePhotoSerializer(*args, **kwargs)[source]
Bases:
BaseRSRSerializer
- class Meta[source]
Bases:
object
- fields = '__all__'
- model
alias of
ProjectUpdatePhoto
- class akvo.rest.serializers.project_update.ProjectUpdateSerializer(*args, **kwargs)[source]
Bases:
BaseRSRSerializer
Serializer for project updates.
- class Meta[source]
Bases:
object
- extra_kwargs = {'photo_caption': {'allow_null': True, 'required': False}, 'photo_credit': {'allow_null': True, 'required': False}, 'video_caption': {'allow_null': True, 'required': False}, 'video_credit': {'allow_null': True, 'required': False}}
- fields = '__all__'
- model
alias of
ProjectUpdate
- read_only_fields = ['user']
- 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.