Example #1
0
    def validate_names(self, value):
        for name in value:
            StartDateEndDateValidator('start_date', 'end_date')(name)

        if len(value) == 0:
            raise serializers.ValidationError(
                _("Agents requires at least one name"))

        return value
Example #2
0
    class Meta(AccessAidSerializer.Meta):
        fields = ('name', 'type', 'description', 'start_date', 'end_date',
                  'security_level', 'link')

        validators = [
            StartDateEndDateValidator(
                start_date='start_date',
                end_date='end_date',
            )
        ]
Example #3
0
 class Meta(AgentSerializer.Meta):
     extra_kwargs = {
         'create_date': {
             'default': timezone.now,
         },
     }
     validators = [
         StartDateEndDateValidator(
             start_date='start_date',
             end_date='end_date',
         )
     ]
Example #4
0
 class Meta(StructureSerializer.Meta):
     fields = StructureSerializer.Meta.fields + ('version_link',)
     validators = [
         StartDateEndDateValidator(
             start_date='start_date',
             end_date='end_date',
         ),
     ]
     extra_kwargs = {
         'is_template': {'read_only': True},
         'template': {'read_only': True},
         'version': {
             'default': '1.0',
         }
     }