admin自动审核
All checks were successful
Deploy to Server / deploy (push) Successful in 25s

This commit is contained in:
jeremygan2021
2026-02-23 17:06:40 +08:00
parent 1a003d93cf
commit e59ae5abbe
2 changed files with 27 additions and 3 deletions

View File

@@ -24,6 +24,17 @@ class ActivityViewSet(viewsets.ReadOnlyModelViewSet):
def retrieve(self, request, *args, **kwargs):
instance = self.get_object()
# Sync status for current user
user = get_current_wechat_user(request)
if user:
# Use filter to avoid exception if multiple exist (though unique_together constraint exists)
signup = instance.signups.filter(user=user).exclude(status='cancelled').first()
if signup:
has_changed = signup.check_payment_status()
if has_changed:
print(f"DEBUG: Synced signup status for user {user.id} activity {instance.id}")
serializer = self.get_serializer(instance)
# Debug print to verify data
print(f"DEBUG: Activity {instance.title} current_signups: {instance.current_signups}")

View File

@@ -99,8 +99,8 @@ DATABASES = {
}
}
# 从环境变量获取数据库配置 (Docker 环境会自动注入这些变量)
#DB_HOST = os.environ.get('DB_HOST', '121.43.104.161')
#从环境变量获取数据库配置 (Docker 环境会自动注入这些变量)
DB_HOST = os.environ.get('DB_HOST', '6.6.6.66')
if DB_HOST:
DATABASES['default'] = {
@@ -109,11 +109,24 @@ if DB_HOST:
'USER': os.environ.get('DB_USER', 'market'),
'PASSWORD': os.environ.get('DB_PASSWORD', '123market'),
'HOST': DB_HOST,
#'PORT': os.environ.get('DB_PORT', '6433'),
'PORT': os.environ.get('DB_PORT', '5432'),
}
# DB_HOST = os.environ.get('DB_HOST', '121.43.104.161')
# if DB_HOST:
# DATABASES['default'] = {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': os.environ.get('DB_NAME', 'market'),
# 'USER': os.environ.get('DB_USER', 'market'),
# 'PASSWORD': os.environ.get('DB_PASSWORD', '123market'),
# 'HOST': DB_HOST,
# 'PORT': os.environ.get('DB_PORT', '6433'),
# }
# Password validation
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators