Display "Former Member" for all non-member statuses
This commit is contained in:
parent
b214dc230f
commit
6c7464fe67
|
@ -112,12 +112,17 @@ class TransactionSerializer(serializers.ModelSerializer):
|
|||
|
||||
# member viewing other members
|
||||
class OtherMemberSerializer(serializers.ModelSerializer):
|
||||
status = serializers.SerializerMethodField()
|
||||
class Meta:
|
||||
model = models.Member
|
||||
fields = ['id', 'preferred_name', 'last_name', 'status', 'current_start_date', 'photo_small', 'photo_large']
|
||||
|
||||
def get_status(self, obj):
|
||||
return 'Former Member' if obj.paused_date else obj.status
|
||||
|
||||
# member viewing his own details
|
||||
class MemberSerializer(serializers.ModelSerializer):
|
||||
status = serializers.SerializerMethodField()
|
||||
photo = serializers.ImageField(write_only=True, required=False)
|
||||
email = UserEmailField(serializers.EmailField)
|
||||
phone = serializers.CharField()
|
||||
|
@ -147,6 +152,9 @@ class MemberSerializer(serializers.ModelSerializer):
|
|||
'old_email',
|
||||
]
|
||||
|
||||
def get_status(self, obj):
|
||||
return 'Former Member' if obj.paused_date else obj.status
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
if instance.user:
|
||||
instance.user.email = validated_data.get('email', instance.user.email)
|
||||
|
|
Loading…
Reference in New Issue
Block a user