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.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.contrib.postgres.fields import ArrayField
from django.conf import settings from django.conf import settings
@@ -10,6 +10,8 @@ from django.conf import settings
from users.models import User from users.models import User
NICKNAME_LEN = 20
class Portfolio(BaseModel): class Portfolio(BaseModel):
title = models.CharField(max_length=20) title = models.CharField(max_length=20)
category = ArrayField(models.CharField(max_length=20), default=list) category = ArrayField(models.CharField(max_length=20), default=list)
@@ -18,8 +20,9 @@ class Portfolio(BaseModel):
like_count = models.IntegerField(default=0) like_count = models.IntegerField(default=0)
scrap_count = models.IntegerField(default=0) scrap_count = models.IntegerField(default=0)
is_represent = models.BooleanField(default=False) is_represent = models.BooleanField(default=False)
thumbnail = models.ImageField(upload_to=dynamic_upload_to('portfolio', lambda instance: 'thumbnail'), blank=True) now_worker = models.CharField(max_length=NICKNAME_LEN, blank=True)
code_id = models.CharField(max_length=26, 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") 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) 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) scrappers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='scrapped_portfolios', blank=True)

View File

@@ -3,7 +3,7 @@ from django.db import models
from common.models.baseModels import BaseModel from common.models.baseModels import BaseModel
from common.models.choiceModels import InvitationStatus from common.models.choiceModels import InvitationStatus
from common.utils.fileManager import dynamic_upload_to from common.utils.fileManager import DynamicUploadTo
from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.fields import ArrayField
from django.conf import settings from django.conf import settings
@@ -12,6 +12,8 @@ from notifications.models import Notification
from users.models import User from users.models import User
NICKNAME_LEN = 20
class Project(BaseModel): class Project(BaseModel):
title = models.CharField(max_length=20) title = models.CharField(max_length=20)
is_team = models.BooleanField(default=False) is_team = models.BooleanField(default=False)
@@ -22,8 +24,9 @@ class Project(BaseModel):
like_count = models.IntegerField(default=0) like_count = models.IntegerField(default=0)
scrap_count = models.IntegerField(default=0) scrap_count = models.IntegerField(default=0)
is_represent = models.BooleanField(default=False) is_represent = models.BooleanField(default=False)
thumbnail = models.ImageField(upload_to=dynamic_upload_to('project', lambda instance: 'thumbnail'), blank=True) now_worker = models.CharField(max_length=NICKNAME_LEN, blank=True)
code_id = models.CharField(max_length=26, blank=True) thumbnail = models.ImageField(upload_to=DynamicUploadTo("project", "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_projects', to_field="id") owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='owned_projects', to_field="id")
likers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='liked_projects', blank=True) likers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='liked_projects', blank=True)
scrappers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='scrapped_projects', blank=True) scrappers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='scrapped_projects', blank=True)