Initial commit
This commit is contained in:
92
main/migrations/0001_initial.py
Normal file
92
main/migrations/0001_initial.py
Normal file
@@ -0,0 +1,92 @@
|
||||
# Generated by Django 5.1.4 on 2025-01-03 14:10
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="File",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("file", models.FileField(upload_to="uploads/")),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("description", models.TextField(blank=True)),
|
||||
(
|
||||
"owner",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="files",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
(
|
||||
"shared_with",
|
||||
models.ManyToManyField(
|
||||
blank=True,
|
||||
related_name="shared_files",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Message",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("content", models.TextField()),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
"file",
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
to="main.file",
|
||||
),
|
||||
),
|
||||
(
|
||||
"recipients",
|
||||
models.ManyToManyField(
|
||||
related_name="received_messages", to=settings.AUTH_USER_MODEL
|
||||
),
|
||||
),
|
||||
(
|
||||
"sender",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="sent_messages",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-created_at"],
|
||||
},
|
||||
),
|
||||
]
|
||||
36
main/migrations/0002_publicmessage.py
Normal file
36
main/migrations/0002_publicmessage.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# Generated by Django 5.1.4 on 2025-01-04 12:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("main", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="PublicMessage",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(blank=True, max_length=100)),
|
||||
("content", models.TextField()),
|
||||
(
|
||||
"file",
|
||||
models.FileField(
|
||||
blank=True, null=True, upload_to="public_uploads/"
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
35
main/migrations/0003_publicfile_remove_publicmessage_file.py
Normal file
35
main/migrations/0003_publicfile_remove_publicmessage_file.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Generated by Django 5.1.4 on 2025-01-04 13:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("main", "0002_publicmessage"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="PublicFile",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(blank=True, max_length=100)),
|
||||
("file", models.FileField(upload_to="public_uploads/")),
|
||||
("description", models.TextField(blank=True)),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="publicmessage",
|
||||
name="file",
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.1.4 on 2025-01-04 14:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("main", "0003_publicfile_remove_publicmessage_file"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="publicfile",
|
||||
name="ip_address",
|
||||
field=models.GenericIPAddressField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="publicmessage",
|
||||
name="ip_address",
|
||||
field=models.GenericIPAddressField(blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="publicfile",
|
||||
name="name",
|
||||
field=models.CharField(default="公共", editable=False, max_length=100),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="publicmessage",
|
||||
name="name",
|
||||
field=models.CharField(default="公共", editable=False, max_length=100),
|
||||
),
|
||||
]
|
||||
63
main/migrations/0005_friendship.py
Normal file
63
main/migrations/0005_friendship.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# Generated by Django 5.1.4 on 2025-01-04 15:21
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("main", "0004_publicfile_ip_address_publicmessage_ip_address_and_more"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Friendship",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"status",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("pending", "等待中"),
|
||||
("accepted", "已接受"),
|
||||
("rejected", "已拒绝"),
|
||||
],
|
||||
default="pending",
|
||||
max_length=10,
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
"from_user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="friendship_requests_sent",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
(
|
||||
"to_user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="friendship_requests_received",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-created_at"],
|
||||
"unique_together": {("from_user", "to_user")},
|
||||
},
|
||||
),
|
||||
]
|
||||
0
main/migrations/__init__.py
Normal file
0
main/migrations/__init__.py
Normal file
BIN
main/migrations/__pycache__/0001_initial.cpython-310.pyc
Normal file
BIN
main/migrations/__pycache__/0001_initial.cpython-310.pyc
Normal file
Binary file not shown.
BIN
main/migrations/__pycache__/0002_publicmessage.cpython-310.pyc
Normal file
BIN
main/migrations/__pycache__/0002_publicmessage.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
main/migrations/__pycache__/0005_friendship.cpython-310.pyc
Normal file
BIN
main/migrations/__pycache__/0005_friendship.cpython-310.pyc
Normal file
Binary file not shown.
BIN
main/migrations/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
main/migrations/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user