mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-20 08:49:24 +00:00
Migrate albums and pictures to their own tables
This commit is contained in:
@ -25,13 +25,12 @@ import warnings
|
||||
from datetime import timedelta
|
||||
from typing import Final, Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from club.models import Club, Membership
|
||||
from core.models import Group, Page, SithFile, User
|
||||
from core.models import Group, Page, User
|
||||
from sas.models import Album, PeoplePictureRelation, Picture
|
||||
from subscription.models import Subscription
|
||||
|
||||
@ -98,13 +97,8 @@ class Command(BaseCommand):
|
||||
self.NB_CLUBS = options["club_count"]
|
||||
|
||||
root = User.objects.filter(username="root").first()
|
||||
sas = SithFile.objects.get(id=settings.SITH_SAS_ROOT_DIR_ID)
|
||||
self.galaxy_album = Album.objects.create(
|
||||
name="galaxy-register-file",
|
||||
owner=root,
|
||||
is_moderated=True,
|
||||
is_in_sas=True,
|
||||
parent=sas,
|
||||
name="galaxy-register-file", owner=root, is_moderated=True
|
||||
)
|
||||
|
||||
self.make_clubs()
|
||||
@ -288,14 +282,10 @@ class Command(BaseCommand):
|
||||
owner=u,
|
||||
name=f"galaxy-picture {u} {i // self.NB_USERS}",
|
||||
is_moderated=True,
|
||||
is_folder=False,
|
||||
parent=self.galaxy_album,
|
||||
is_in_sas=True,
|
||||
file=ContentFile(RED_PIXEL_PNG),
|
||||
original=ContentFile(RED_PIXEL_PNG),
|
||||
compressed=ContentFile(RED_PIXEL_PNG),
|
||||
thumbnail=ContentFile(RED_PIXEL_PNG),
|
||||
mime_type="image/png",
|
||||
size=len(RED_PIXEL_PNG),
|
||||
)
|
||||
)
|
||||
self.picts[i].file.name = self.picts[i].name
|
||||
|
Reference in New Issue
Block a user