-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e48509
commit dd96a0d
Showing
9 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import pytz | ||
|
||
|
||
def convert_to_timezone(datetime_obj, timezone_str): | ||
target_timezone = pytz.timezone(timezone_str) | ||
converted_datetime = datetime_obj.astimezone(target_timezone) | ||
return converted_datetime.strftime('%Y-%m-%d %H:%M') |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import json | ||
|
||
from django.http import JsonResponse | ||
from Server01.util.verifyJWT import authenticate_request | ||
|
||
from Server01.models import Comment | ||
from Server01.util.verifyJWT import authenticate_request | ||
|
||
|
||
@authenticate_request | ||
def do_comment(request, verify_payload): | ||
data = json.loads(request.body) | ||
print(verify_payload) | ||
user_id = verify_payload['user_id'] | ||
data['user_id'] = user_id | ||
comment = Comment.objects.create(**data) | ||
return JsonResponse({'info': '评论已发送!', 'id': comment.id}, status=200) | ||
return JsonResponse({'info': '评论已发送!', 'id': comment.id}, status=200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters