Skip to content

Commit

Permalink
hotfix - staff spot checks
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Aug 7, 2019
1 parent 430ec96 commit 321a200
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/etools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = __version__ = '7.2'
VERSION = __version__ = '7.2.1'
NAME = 'eTools'
7 changes: 6 additions & 1 deletion src/etools/applications/audit/serializers/auditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class AuditorStaffMemberSerializer(BaseStaffMemberSerializer):
def validate(self, attrs):
validated_data = super().validate(attrs)
user_pk = validated_data.pop('user_pk', None)

if user_pk:
if hasattr(user_pk, 'purchase_order_auditorstaffmember'):
firm = user_pk.purchase_order_auditorstaffmember.auditor_firm
Expand All @@ -48,6 +47,12 @@ def validate(self, attrs):
validated_data['user'] = user_pk
elif 'user' not in validated_data:
raise serializers.ValidationError({'user': _('This field is required.')})
else:
try:
email = validated_data['user'].get('email', 'invalid')
validated_data['user'] = get_user_model().objects.get(email=email)
except get_user_model().DoesNotExist:
pass

return validated_data

Expand Down

0 comments on commit 321a200

Please sign in to comment.