fix timezone convert error
This commit is contained in:
parent
8bbcf26fe2
commit
64e5f2c8e9
3 changed files with 8 additions and 6 deletions
|
@ -175,7 +175,9 @@ def mark(request, item_uuid):
|
|||
mark_date = None
|
||||
if request.POST.get("mark_anotherday"):
|
||||
dt = parse_datetime(request.POST.get("mark_date", "") + " 20:00:00")
|
||||
mark_date = timezone.get_current_timezone().localize(dt) if dt else None
|
||||
mark_date = (
|
||||
dt.replace(tzinfo=timezone.get_current_timezone()) if dt else None
|
||||
)
|
||||
if mark_date and mark_date >= timezone.now():
|
||||
mark_date = None
|
||||
TagManager.tag_item_by_user(item, request.user, tags, visibility)
|
||||
|
@ -612,8 +614,9 @@ def review_edit(request, item_uuid, review_uuid=None):
|
|||
if form.is_valid():
|
||||
mark_date = None
|
||||
if request.POST.get("mark_anotherday"):
|
||||
mark_date = timezone.get_current_timezone().localize(
|
||||
parse_datetime(request.POST.get("mark_date") + " 20:00:00")
|
||||
dt = parse_datetime(request.POST.get("mark_date") + " 20:00:00")
|
||||
mark_date = (
|
||||
dt.replace(tzinfo=timezone.get_current_timezone()) if dt else None
|
||||
)
|
||||
body = form.instance.body
|
||||
if request.POST.get("leading_space"):
|
||||
|
|
|
@ -9,8 +9,7 @@ from urllib.parse import quote
|
|||
from .models import MastodonApplication
|
||||
from mastodon.utils import rating_to_emoji
|
||||
import re
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
from loguru import logger
|
||||
|
||||
# See https://docs.joinmastodon.org/methods/accounts/
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ class User(AbstractUser):
|
|||
self.mastodon_account = mastodon_account
|
||||
self.mastodon_locked = mastodon_account["locked"]
|
||||
if self.mastodon_username != mastodon_account["username"]:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
f"username changed from {self} to {mastodon_account['username']}"
|
||||
)
|
||||
self.mastodon_username = mastodon_account["username"]
|
||||
|
|
Loading…
Add table
Reference in a new issue