2026-02-06 09:23:02 +00:00

26 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from django.core.management.base import BaseCommand
from core.models import SiteSettings, Cryptocurrency
import decimal
class Command(BaseCommand):
help = 'Seed initial site settings and data'
def handle(self, *args, **options):
# Site Settings
settings, created = SiteSettings.objects.get_or_create(id=1)
settings.site_name = "BitCrypto"
settings.customer_service_url = "https://t.me/bitcrypto_support"
settings.terms_content = "欢迎使用 BitCrypto。通过访问我们的平台您同意遵守以下条款1. 用户必须年满 18 岁。2. 您对账户的安全负全部责任。3. 加密货币交易具有高度风险..."
settings.privacy_content = "我们重视您的隐私。BitCrypto 仅收集必要的个人信息以提供服务。我们使用先进的加密技术保护您的数据,绝不向第三方出售您的个人信息。"
settings.save()
self.stdout.write(self.style.SUCCESS('Successfully seeded site settings'))
# Ensure BTC exists
btc, created = Cryptocurrency.objects.get_or_create(symbol="BTC")
btc.name = "Bitcoin"
btc.current_price = decimal.Decimal("48000.00")
btc.save()
self.stdout.write(self.style.SUCCESS('Successfully seeded cryptocurrencies'))