Fix Django migration issues and add missing URLs
- Create missing templates app urls.py - Fix REST_FRAMEWORK pagination settings - Add DEFAULT_AUTO_FIELD configuration - Create migration files for all apps - Fix auto-generated model warnings - Verify database setup with test project
This commit is contained in:
BIN
backend/apps/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
backend/apps/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/exports/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
backend/apps/exports/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/exports/__pycache__/urls.cpython-314.pyc
Normal file
BIN
backend/apps/exports/__pycache__/urls.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/exports/__pycache__/utils.cpython-314.pyc
Normal file
BIN
backend/apps/exports/__pycache__/utils.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/exports/__pycache__/views.cpython-314.pyc
Normal file
BIN
backend/apps/exports/__pycache__/views.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/projects/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
backend/apps/projects/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/projects/__pycache__/models.cpython-314.pyc
Normal file
BIN
backend/apps/projects/__pycache__/models.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/projects/__pycache__/serializers.cpython-314.pyc
Normal file
BIN
backend/apps/projects/__pycache__/serializers.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/projects/__pycache__/urls.cpython-314.pyc
Normal file
BIN
backend/apps/projects/__pycache__/urls.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/projects/__pycache__/views.cpython-314.pyc
Normal file
BIN
backend/apps/projects/__pycache__/views.cpython-314.pyc
Normal file
Binary file not shown.
69
backend/apps/projects/migrations/0001_initial.py
Normal file
69
backend/apps/projects/migrations/0001_initial.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# Generated by Django 5.1.4 on 2026-05-31 07:59
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Project',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
('template_id', models.CharField(default='classic', max_length=50)),
|
||||||
|
('card_width', models.IntegerField(default=750)),
|
||||||
|
('card_height', models.IntegerField(default=1050)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('export_resolution', models.CharField(default='standard', max_length=20)),
|
||||||
|
('export_include_back', models.BooleanField(default=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['-updated_at'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CardLayer',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('card_type', models.CharField(max_length=20)),
|
||||||
|
('card_key', models.CharField(max_length=30)),
|
||||||
|
('layer_name', models.CharField(max_length=50)),
|
||||||
|
('layer_type', models.CharField(max_length=20)),
|
||||||
|
('visible', models.BooleanField(default=True)),
|
||||||
|
('locked', models.BooleanField(default=False)),
|
||||||
|
('opacity', models.FloatField(default=1.0)),
|
||||||
|
('z_index', models.IntegerField(default=0)),
|
||||||
|
('properties', models.JSONField(default=dict)),
|
||||||
|
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='layers', to='projects.project')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['card_key', 'z_index'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Asset',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('asset_type', models.CharField(max_length=20)),
|
||||||
|
('asset_key', models.CharField(max_length=50)),
|
||||||
|
('file_path', models.CharField(max_length=255)),
|
||||||
|
('file_name', models.CharField(max_length=100)),
|
||||||
|
('width', models.IntegerField(null=True)),
|
||||||
|
('height', models.IntegerField(null=True)),
|
||||||
|
('uploaded_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assets', to='projects.project')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['-uploaded_at'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
0
backend/apps/projects/migrations/__init__.py
Normal file
0
backend/apps/projects/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
BIN
backend/apps/templates/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
backend/apps/templates/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/templates/__pycache__/models.cpython-314.pyc
Normal file
BIN
backend/apps/templates/__pycache__/models.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/templates/__pycache__/urls.cpython-314.pyc
Normal file
BIN
backend/apps/templates/__pycache__/urls.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/apps/templates/__pycache__/views.cpython-314.pyc
Normal file
BIN
backend/apps/templates/__pycache__/views.cpython-314.pyc
Normal file
Binary file not shown.
44
backend/apps/templates/migrations/0001_initial.py
Normal file
44
backend/apps/templates/migrations/0001_initial.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Generated by Django 5.1.4 on 2026-05-31 07:59
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CardTemplate',
|
||||||
|
fields=[
|
||||||
|
('id', models.CharField(max_length=50, primary_key=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
('description', models.TextField()),
|
||||||
|
('preview_image', models.ImageField(null=True, upload_to='templates/previews/')),
|
||||||
|
('color_spade', models.CharField(default='#000000', max_length=20)),
|
||||||
|
('color_heart', models.CharField(default='#FF0000', max_length=20)),
|
||||||
|
('color_club', models.CharField(default='#000000', max_length=20)),
|
||||||
|
('color_diamond', models.CharField(default='#FF0000', max_length=20)),
|
||||||
|
('color_background', models.CharField(default='#FFFFFF', max_length=20)),
|
||||||
|
('default_assets', models.JSONField(default=dict)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['name'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='SuitSymbol',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('suit_name', models.CharField(max_length=20)),
|
||||||
|
('svg_path', models.TextField()),
|
||||||
|
('color', models.CharField(max_length=20)),
|
||||||
|
('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='suit_symbols', to='templates.cardtemplate')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
0
backend/apps/templates/migrations/__init__.py
Normal file
0
backend/apps/templates/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
9
backend/apps/templates/urls.py
Normal file
9
backend/apps/templates/urls.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from .views import template_list, template_detail
|
||||||
|
|
||||||
|
app_name = 'templates'
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('templates/', template_list, name='template-list'),
|
||||||
|
path('templates/<str:pk>/', template_detail, name='template-detail'),
|
||||||
|
]
|
||||||
BIN
backend/db.sqlite3
Normal file
BIN
backend/db.sqlite3
Normal file
Binary file not shown.
BIN
backend/poker_api/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
backend/poker_api/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/poker_api/__pycache__/settings.cpython-314.pyc
Normal file
BIN
backend/poker_api/__pycache__/settings.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/poker_api/__pycache__/urls.cpython-314.pyc
Normal file
BIN
backend/poker_api/__pycache__/urls.cpython-314.pyc
Normal file
Binary file not shown.
BIN
backend/poker_api/__pycache__/wsgi.cpython-314.pyc
Normal file
BIN
backend/poker_api/__pycache__/wsgi.cpython-314.pyc
Normal file
Binary file not shown.
@@ -61,6 +61,8 @@ TIME_ZONE = 'Asia/Shanghai'
|
|||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
@@ -74,6 +76,6 @@ CORS_ALLOWED_ORIGINS = [
|
|||||||
CORS_ALLOW_CREDENTIALS = True
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_PAGINATION': 'rest_framework.pagination.PageNumberPagination',
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||||
'PAGE_SIZE': 20,
|
'PAGE_SIZE': 20,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user