mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Increased JWT time to expire and improved student status serializer
This commit is contained in:
parent
49afdc981f
commit
813734582a
3 changed files with 5 additions and 5 deletions
|
@ -235,8 +235,8 @@ else:
|
|||
SITE_NAME = 'Stud-E'
|
||||
|
||||
SIMPLE_JWT = {
|
||||
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=360),
|
||||
"REFRESH_TOKEN_LIFETIME": timedelta(minutes=360)
|
||||
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=3600),
|
||||
"REFRESH_TOKEN_LIFETIME": timedelta(minutes=3600)
|
||||
}
|
||||
|
||||
LEAFLET_CONFIG = {
|
||||
|
|
|
@ -39,7 +39,7 @@ class StudentStatusSerializer(serializers.ModelSerializer):
|
|||
validated_data['location'] = Point(0, 0)
|
||||
validated_data['subject'] = None
|
||||
validated_data['landmark'] = None
|
||||
validated_data['study_group'] = None
|
||||
validated_data['study_group'] = []
|
||||
else:
|
||||
if 'subject' not in validated_data:
|
||||
raise serializers.ValidationError(
|
||||
|
|
|
@ -42,7 +42,7 @@ class StudentStatusListByStudentStatusLocation(generics.ListAPIView):
|
|||
user_location = fromstr(
|
||||
user_status.location, srid=4326)
|
||||
|
||||
return StudentStatus.objects.filter(subject__in=user.subjects.all()).annotate(distance=Distance('location', user_location)).filter(distance__lte=50)
|
||||
return StudentStatus.objects.filter(user != user).filter(subject__in=user.subjects.all()).annotate(distance=Distance('location', user_location)).filter(distance__lte=50)
|
||||
|
||||
|
||||
class StudentStatusListByCurrentLocation(viewsets.ViewSet):
|
||||
|
@ -57,7 +57,7 @@ class StudentStatusListByCurrentLocation(viewsets.ViewSet):
|
|||
raise exceptions.ValidationError("Location is required")
|
||||
|
||||
user_location = fromstr(location_str, srid=4326)
|
||||
queryset = StudentStatus.objects.filter(subject__in=user.subjects.all()).annotate(
|
||||
queryset = StudentStatus.objects.filter(user != user).filter(subject__in=user.subjects.all()).annotate(
|
||||
distance=Distance('location', user_location)).filter(distance__lte=50)
|
||||
serializer = StudentStatusLocationSerializer(queryset, many=True)
|
||||
return Response(serializer.data)
|
||||
|
|
Loading…
Reference in a new issue