|
|
|
@ -80,12 +80,11 @@ class ApplySerializer(serializers.Serializer):
|
|
|
|
|
applications = Application.objects.filter(id__in=apply_applications, type=type).values_list('id', flat=True)
|
|
|
|
|
return list(applications)
|
|
|
|
|
|
|
|
|
|
def validate_apply_date_expired(self, value):
|
|
|
|
|
date_start = self.root.initial_data['meta'].get('apply_date_start')
|
|
|
|
|
date_start = datetime.strptime(date_start, '%Y-%m-%dT%H:%M:%S.%fZ')
|
|
|
|
|
date_expired = self.root.initial_data['meta'].get('apply_date_expired')
|
|
|
|
|
date_expired = datetime.strptime(date_expired, '%Y-%m-%dT%H:%M:%S.%fZ')
|
|
|
|
|
if date_expired <= date_start:
|
|
|
|
|
def validate(self, attrs):
|
|
|
|
|
apply_date_start = attrs['apply_date_start']
|
|
|
|
|
apply_date_expired = attrs['apply_date_expired']
|
|
|
|
|
|
|
|
|
|
if apply_date_expired <= apply_date_start:
|
|
|
|
|
error = _('The expiration date should be greater than the start date')
|
|
|
|
|
raise serializers.ValidationError(error)
|
|
|
|
|
return value
|
|
|
|
|
raise serializers.ValidationError({'apply_date_expired': error})
|
|
|
|
|
return attrs
|
|
|
|
|