Feat: [#64] now_worker 추가, thumbnail, code_id 수정

This commit is contained in:
sm4640
2025-06-05 18:22:38 +09:00
parent c693acf79d
commit 0b413322f9
2 changed files with 12 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ from django.db import models
from common.models.baseModels import BaseModel
from common.utils.fileManager import dynamic_upload_to
from common.utils.fileManager import DynamicUploadTo
from django.contrib.postgres.fields import ArrayField
from django.conf import settings
@@ -10,6 +10,8 @@ from django.conf import settings
from users.models import User
NICKNAME_LEN = 20
class Portfolio(BaseModel):
title = models.CharField(max_length=20)
category = ArrayField(models.CharField(max_length=20), default=list)
@@ -18,8 +20,9 @@ class Portfolio(BaseModel):
like_count = models.IntegerField(default=0)
scrap_count = models.IntegerField(default=0)
is_represent = models.BooleanField(default=False)
thumbnail = models.ImageField(upload_to=dynamic_upload_to('portfolio', lambda instance: 'thumbnail'), blank=True)
code_id = models.CharField(max_length=26, blank=True)
now_worker = models.CharField(max_length=NICKNAME_LEN, blank=True)
thumbnail = models.ImageField(upload_to=DynamicUploadTo("portfolio", "thumbnail"), null=True, blank=True)
code_id = models.CharField(max_length=26, null=True, blank=True)
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='owned_portfolios', to_field="id")
likers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='liked_portfolios', blank=True)
scrappers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='scrapped_portfolios', blank=True)