Files
game-cards-poker-design/backend/apps/templates/models.py
Poker Design Developer 48629736f4 Implement Django backend and Vue frontend structure
- Django backend with projects, templates, exports apps
- SQLite database models for Project, Asset, CardLayer
- REST API endpoints for project management
- Vue frontend with Vite, Element Plus, Fabric.js
- Home page for project selection
- Editor page with Fabric.js canvas integration
2026-05-31 14:55:01 +08:00

39 lines
1.4 KiB
Python
Raw 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.db import models
import uuid
class CardTemplate(models.Model):
"""扑克牌模板模型"""
id = models.CharField(max_length=50, primary_key=True) # 'classic', 'modern', etc.
name = models.CharField(max_length=100)
description = models.TextField()
preview_image = models.ImageField(upload_to='templates/previews/', null=True)
# 默认配色方案
color_spade = models.CharField(max_length=20, default='#000000')
color_heart = models.CharField(max_length=20, default='#FF0000')
color_club = models.CharField(max_length=20, default='#000000')
color_diamond = models.CharField(max_length=20, default='#FF0000')
color_background = models.CharField(max_length=20, default='#FFFFFF')
# 默认素材路径JSON
default_assets = models.JSONField(default=dict)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.name
class Meta:
ordering = ['name']
class SuitSymbol(models.Model):
"""花色图案模板"""
template = models.ForeignKey(CardTemplate, on_delete=models.CASCADE, related_name='suit_symbols')
suit_name = models.CharField(max_length=20) # 'spade', 'heart', 'club', 'diamond'
svg_path = models.TextField() # SVG路径数据
color = models.CharField(max_length=20)
def __str__(self):
return f"{self.template.name} - {self.suit_name}"