Skip to content

Commit

Permalink
More tweaks to new attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Sep 7, 2024
1 parent ece0ae1 commit 17fd44c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions misago/attachments/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("secret", models.CharField(max_length=64)),
(
"filetype",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="misago_attachments.attachmenttype",
),
),
(
"post",
models.ForeignKey(
Expand All @@ -94,12 +86,6 @@ class Migration(migrations.Migration):
to="misago_threads.post",
),
),
(
"uploaded_on",
models.DateTimeField(
db_index=True, default=django.utils.timezone.now
),
),
(
"uploader",
models.ForeignKey(
Expand All @@ -112,6 +98,20 @@ class Migration(migrations.Migration):
),
("uploader_name", models.CharField(max_length=255)),
("uploader_slug", models.CharField(max_length=255)),
(
"uploaded_at",
models.DateTimeField(
db_index=True, default=django.utils.timezone.now
),
),
("secret", models.CharField(max_length=64)),
(
"filetype",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="misago_attachments.attachmenttype",
),
),
("filename", models.CharField(db_index=True, max_length=255)),
("size", models.PositiveIntegerField(db_index=True, default=0)),
(
Expand Down
4 changes: 2 additions & 2 deletions misago/attachments/migrations/0002_move_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class Migration(migrations.Migration):
secret,
filetype_id,
post_id,
uploaded_on,
uploader_id,
uploader_name,
uploader_slug,
uploaded_at,
filename,
size,
thumbnail,
Expand All @@ -53,10 +53,10 @@ class Migration(migrations.Migration):
secret,
filetype_id,
post_id,
uploaded_on,
uploader_id,
uploader_name,
uploader_slug,
uploaded_on,
filename,
size,
thumbnail,
Expand Down
10 changes: 5 additions & 5 deletions misago/attachments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def upload_to(instance, filename):


class Attachment(PluginDataModel):
secret = models.CharField(max_length=64)
filetype = models.ForeignKey("AttachmentType", on_delete=models.CASCADE)

post = models.ForeignKey(
"misago_threads.Post",
blank=True,
Expand All @@ -47,8 +44,6 @@ class Attachment(PluginDataModel):
on_delete=models.SET_NULL,
)

uploaded_on = models.DateTimeField(default=timezone.now, db_index=True)

uploader = models.ForeignKey(
settings.AUTH_USER_MODEL,
blank=True,
Expand All @@ -59,6 +54,11 @@ class Attachment(PluginDataModel):
uploader_name = models.CharField(max_length=255)
uploader_slug = models.CharField(max_length=255)

uploaded_at = models.DateTimeField(default=timezone.now, db_index=True)

secret = models.CharField(max_length=64)

filetype = models.ForeignKey("AttachmentType", on_delete=models.CASCADE)
filename = models.CharField(max_length=255, db_index=True)
size = models.PositiveIntegerField(default=0, db_index=True)

Expand Down

0 comments on commit 17fd44c

Please sign in to comment.