Make sure number of membership months is entered.
This commit is contained in:
parent
24a0f37faa
commit
6a3ce847d6
|
@ -93,6 +93,9 @@ class TransactionSerializer(serializers.ModelSerializer):
|
||||||
if validated_data['category'] != 'Membership':
|
if validated_data['category'] != 'Membership':
|
||||||
validated_data['number_of_membership_months'] = 0
|
validated_data['number_of_membership_months'] = 0
|
||||||
|
|
||||||
|
if validated_data['category'] == 'Membership' and not validated_data['number_of_membership_months']:
|
||||||
|
raise ValidationError(dict(number_of_membership_months='This field is required.'))
|
||||||
|
|
||||||
if validated_data['account_type'] == 'Protocoin' and validated_data['category'] == 'Exchange':
|
if validated_data['account_type'] == 'Protocoin' and validated_data['category'] == 'Exchange':
|
||||||
raise ValidationError(dict(category='Can\'t purchase Protocoin with Protocoin.'))
|
raise ValidationError(dict(category='Can\'t purchase Protocoin with Protocoin.'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user