summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chat_api/models.py2
-rw-r--r--chat_api/serializers.py4
-rw-r--r--index.http6
-rw-r--r--lom_api/settings.py3
4 files changed, 13 insertions, 2 deletions
diff --git a/chat_api/models.py b/chat_api/models.py
index 3be795a..3a3f51e 100644
--- a/chat_api/models.py
+++ b/chat_api/models.py
@@ -18,7 +18,7 @@ class Group(models.Model):
18 create_date = models.DateTimeField(auto_now=True) 18 create_date = models.DateTimeField(auto_now=True)
19 19
20 def __str__(self): 20 def __str__(self):
21 return self.name 21 return str(self.pk) + " " + self.name
22 22
23class Gm(models.Model): 23class Gm(models.Model):
24 sender = models.ForeignKey(User, related_name="sender_gm", on_delete=models.CASCADE) 24 sender = models.ForeignKey(User, related_name="sender_gm", on_delete=models.CASCADE)
diff --git a/chat_api/serializers.py b/chat_api/serializers.py
index 15828be..dee0c45 100644
--- a/chat_api/serializers.py
+++ b/chat_api/serializers.py
@@ -1,6 +1,9 @@
1from django.db.models import fields 1from django.db.models import fields
2from django.contrib.auth.models import User
3
2from rest_framework import serializers 4from rest_framework import serializers
3from .models import * 5from .models import *
6from auth_api.serializers import UserSerializer
4 7
5class GroupSerializer(serializers.ModelSerializer): 8class GroupSerializer(serializers.ModelSerializer):
6 is_mine = serializers.SerializerMethodField('_is_mine') 9 is_mine = serializers.SerializerMethodField('_is_mine')
@@ -30,6 +33,7 @@ class DmSerializer(serializers.ModelSerializer):
30 33
31class GmSerializer(serializers.ModelSerializer): 34class GmSerializer(serializers.ModelSerializer):
32 is_mine = serializers.SerializerMethodField('_is_mine') 35 is_mine = serializers.SerializerMethodField('_is_mine')
36 sender = UserSerializer(read_only=True)
33 37
34 def _is_mine(self, obj): 38 def _is_mine(self, obj):
35 request = self.context.get('request') 39 request = self.context.get('request')
diff --git a/index.http b/index.http
index 6349a84..ef0ba9f 100644
--- a/index.http
+++ b/index.http
@@ -32,3 +32,9 @@ content-type: application/json
32 32
33GET http://localhost:8000/api/auth/info/? 33GET http://localhost:8000/api/auth/info/?
34Authorization: Token bd057a90565d85b2efa23f73deb9e5afdb4e4d56b24ba405a1cf33b66b49f4ed 34Authorization: Token bd057a90565d85b2efa23f73deb9e5afdb4e4d56b24ba405a1cf33b66b49f4ed
35
36###
37
38GET http://localhost:8000/api/chat/groups/detail/22/messages/
39Authorization: Token b4bd0a69d9f78c9447b4f7581a8b8cc53f5732a7f6542db9a5fea093ce734b2c
40content-type: application/json
diff --git a/lom_api/settings.py b/lom_api/settings.py
index a09c7a7..77a754e 100644
--- a/lom_api/settings.py
+++ b/lom_api/settings.py
@@ -50,8 +50,9 @@ REST_FRAMEWORK = {
50} 50}
51 51
52REST_KNOX = { 52REST_KNOX = {
53# 'TOKEN_LIMIT_PER_USER': 1, 53 'TOKEN_TTL': None,
54} 54}
55
55 56
56MIDDLEWARE = [ 57MIDDLEWARE = [
57 'django.middleware.security.SecurityMiddleware', 58 'django.middleware.security.SecurityMiddleware',