Skip to content

Commit

Permalink
refactor: load data via server load function and alter quiblet model
Browse files Browse the repository at this point in the history
  • Loading branch information
moonlitgrace committed Dec 16, 2024
1 parent cc05bdf commit 7e6189b
Show file tree
Hide file tree
Showing 8 changed files with 339 additions and 123 deletions.
18 changes: 18 additions & 0 deletions backend/apps/quib/migrations/0005_alter_quibmodel_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.4 on 2024-12-16 11:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('quib', '0004_quibmodel_comments'),
]

operations = [
migrations.AlterField(
model_name='quibmodel',
name='content',
field=models.TextField(blank=True, verbose_name='content'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 5.1.4 on 2024-12-16 11:57

import dynamic_filenames
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('quiblet', '0002_initial'),
]

operations = [
migrations.RemoveField(
model_name='quibletmodel',
name='cover',
),
migrations.AddField(
model_name='quibletmodel',
name='banner',
field=models.ImageField(
blank=True,
null=True,
upload_to=dynamic_filenames.FilePattern(
filename_pattern='banner/{uuid:s}{ext}'
),
verbose_name='banner',
),
),
migrations.AddField(
model_name='quibletmodel',
name='title',
field=models.CharField(
blank=True, max_length=50, null=True, verbose_name='title'
),
),
migrations.AlterField(
model_name='quibletmodel',
name='name',
field=models.CharField(
error_messages={'unique': 'Quiblet with this name already exists.'},
max_length=25,
unique=True,
verbose_name='name',
),
),
]
9 changes: 5 additions & 4 deletions backend/apps/quiblet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from apps.user.models import ProfileModel
from common.mixins.model_mixins import AvatarMixin, CreatedAtMixin, IsPublicMixin

cover_file_pattern = FilePattern(filename_pattern="cover/{uuid:s}{ext}")
banner_file_pattern = FilePattern(filename_pattern="banner/{uuid:s}{ext}")

# Create your models here.

Expand All @@ -20,9 +20,10 @@ class QuibletModel(AvatarMixin, CreatedAtMixin, IsPublicMixin):
error_messages={'unique': 'Quiblet with this name already exists.'},
)
description = models.TextField(_('description'))
cover = models.ImageField(
_('cover'),
upload_to=cover_file_pattern,
title = models.CharField(_('title'), max_length=50, null=True, blank=True)
banner = models.ImageField(
_('banner'),
upload_to=banner_file_pattern,
blank=True,
null=True,
)
Expand Down
Loading

0 comments on commit 7e6189b

Please sign in to comment.