diff options
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/migrations/0013_manual_20200218_1536.py | 2 | ||||
-rw-r--r-- | src/api/models.py | 12 | ||||
-rw-r--r-- | src/api/views.py | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/api/migrations/0013_manual_20200218_1536.py b/src/api/migrations/0013_manual_20200218_1536.py index 0b76e84..3ac427e 100644 --- a/src/api/migrations/0013_manual_20200218_1536.py +++ b/src/api/migrations/0013_manual_20200218_1536.py @@ -1,6 +1,6 @@ # Generated by Django 2.2 on 2020-02-18 15:36 -from django.db import migrations, models +from django.db import migrations class Migration(migrations.Migration): diff --git a/src/api/models.py b/src/api/models.py index addc02d..231ae31 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -176,12 +176,12 @@ class LabManager(object): def format_user(self, userprofile): return { - "id": userprofile.user.id, - "username": userprofile.user.username, - "email": userprofile.email_addr, - "first_name": userprofile.user.first_name, - "last_name": userprofile.user.last_name, - "company": userprofile.company + "id": userprofile.user.id, + "username": userprofile.user.username, + "email": userprofile.email_addr, + "first_name": userprofile.user.first_name, + "last_name": userprofile.user.last_name, + "company": userprofile.company } def get_users(self): diff --git a/src/api/views.py b/src/api/views.py index 4e0d058..75a0db3 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -97,11 +97,13 @@ def lab_status(request, lab_name=""): return JsonResponse(lab_manager.set_status(request.POST), safe=False) return JsonResponse(lab_manager.get_status(), safe=False) + def lab_users(request, lab_name=""): lab_token = request.META.get('HTTP_AUTH_TOKEN') lab_manager = LabManagerTracker.get(lab_name, lab_token) return HttpResponse(lab_manager.get_users(), content_type="text/plain") + def lab_user(request, lab_name="", user_id=-1): lab_token = request.META.get('HTTP_AUTH_TOKEN') lab_manager = LabManagerTracker.get(lab_name, lab_token) |