small fixes

This commit is contained in:
Sam
2021-03-17 10:16:31 +00:00
parent 29d6bc56cb
commit aac2c5777e
3 changed files with 3 additions and 2 deletions

View File

@@ -295,6 +295,7 @@ class CompanyViewSetTest(APITestCase):
# TODO: test email_manager action # TODO: test email_manager action
class MyCompanyViewTest(APITestCase): class MyCompanyViewTest(APITestCase):
"""CompanyViewset tests """CompanyViewset tests
""" """

View File

@@ -254,7 +254,7 @@ class CategoryTagAutocomplete(autocomplete.Select2QuerySetView):
def purchase_email(request): def purchase_email(request):
"""Notify coop manager and user about item purchase """Notify coop manager and user about item purchase
""" """
data = json.loads(request.body) data = request.data
# check data # check data
if request.user.is_anonymous and 'email' not in data: if request.user.is_anonymous and 'email' not in data:
return Response({"error": "Anonymous users must include an email parameter value"}, status=status.HTTP_406_NOT_ACCEPTABLE) return Response({"error": "Anonymous users must include an email parameter value"}, status=status.HTTP_406_NOT_ACCEPTABLE)

View File

@@ -50,7 +50,7 @@ def track_user(request):
} }
""" """
try: try:
data = json.loads(request.body) data = request.data
if data.get('geo'): if data.get('geo'):
coordinates = (data['geo'].get('latitude'), data['geo'].get('longitude')) coordinates = (data['geo'].get('latitude'), data['geo'].get('longitude'))