Skip to content

Commit 70e252a

Browse files
committed
Обновление модели проекта
1 parent e896e39 commit 70e252a

3 files changed

Lines changed: 45 additions & 61 deletions

File tree

projects/constants.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

projects/models.py

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
from django.contrib.auth import get_user_model
44
from django.contrib.contenttypes.fields import GenericRelation
5-
from django.core.validators import MaxLengthValidator
5+
from django.core.validators import (
6+
MaxLengthValidator,
7+
MaxValueValidator,
8+
MinValueValidator,
9+
)
610
from django.db import models
711
from django.db.models import UniqueConstraint
812

913
from core.models import Like, View
1014
from files.models import UserFile
1115
from industries.models import Industry
12-
from projects.constants import VERBOSE_STEPS
1316
from projects.managers import AchievementManager, CollaboratorManager, ProjectManager
1417
from users.models import CustomUser
1518

@@ -60,61 +63,62 @@ class Meta:
6063

6164
class Project(models.Model):
6265
"""
63-
Project model
64-
65-
Attributes:
66-
name: A CharField name of the project.
67-
description: A TextField description of the project.
68-
region: A CharField region of the project.
69-
step: A PositiveSmallIntegerField which indicates status of the project
70-
according to VERBOSE_STEPS.
71-
industry: A ForeignKey referring to the Industry model.
72-
presentation_address: A URLField presentation URL address.
73-
image_address: A URLField image URL address.
74-
leader: A ForeignKey referring to the User model.
75-
draft: A boolean indicating if Project is a draft.
76-
is_company: A boolean indicating if Project is a company.
77-
cover_image_address: A URLField cover image URL address.
78-
cover: A ForeignKey referring to the UserFile model, which is the image cover of the project.
79-
datetime_created: A DateTimeField indicating date of creation.
80-
datetime_updated: A DateTimeField indicating date of update.
66+
Модель проекта.
67+
68+
Атрибуты:
69+
name (CharField): Название проекта.
70+
description (TextField): Подробное описание проекта.
71+
region (CharField): Регион, в котором реализуется проект.
72+
hidden_score (PositiveSmallIntegerField): Скрытый рейтинг проекта,
73+
используется для внутренней сортировки.
74+
actuality (TextField): Актуальность проекта (почему он важен).
75+
target_audience (CharField): Описание целевой аудитории проекта.
76+
implementation_deadline (DateField): Общий срок реализации проекта (дата завершения).
77+
problem (TextField): Проблема, которую решает проект.
78+
trl (PositiveSmallIntegerField): Уровень технологической готовности (Technology Readiness Level) от 1 до 9.
79+
industry (ForeignKey): Ссылка на отрасль (модель Industry).
80+
presentation_address (URLField): Ссылка на презентацию проекта.
81+
image_address (URLField): Ссылка на изображение (аватар проекта).
82+
leader (ForeignKey): Руководитель проекта (пользователь).
83+
draft (BooleanField): Флаг, указывающий, является ли проект черновиком.
84+
is_company (BooleanField): Признак того, что проект представляет компанию.
85+
cover_image_address (URLField): Ссылка на обложку проекта.
86+
cover (ForeignKey): Файл-обложка проекта (устаревшее поле).
87+
subscribers (ManyToManyField): Подписчики проекта.
88+
datetime_created (DateTimeField): Дата создания проекта.
89+
datetime_updated (DateTimeField): Дата последнего изменения проекта.
8190
"""
8291

8392
name = models.CharField(max_length=256, null=True, blank=True)
8493
description = models.TextField(null=True, blank=True)
8594
region = models.CharField(max_length=256, null=True, blank=True)
86-
step = models.PositiveSmallIntegerField(
87-
choices=VERBOSE_STEPS, null=True, blank=True
88-
)
8995
hidden_score = models.PositiveSmallIntegerField(default=100)
90-
91-
track = models.CharField(
92-
max_length=256,
93-
blank=True,
94-
null=True,
95-
verbose_name="Трек",
96-
help_text="Направление/курс, в рамках которого реализуется проект",
97-
)
98-
direction = models.CharField(
99-
max_length=256,
100-
blank=True,
101-
null=True,
102-
verbose_name="Направление",
103-
help_text="Более общее направление деятельности проекта",
104-
)
10596
actuality = models.TextField(
10697
blank=True,
10798
null=True,
10899
validators=[MaxLengthValidator(1000)],
109100
verbose_name="Актуальность",
110101
help_text="Почему проект важен (до 1000 симв.)",
111102
)
112-
goal = models.CharField(
103+
target_audience = models.CharField(
113104
max_length=500,
114105
blank=True,
115106
null=True,
116-
verbose_name="Цель",
117-
help_text="Главная цель проекта (до 500 симв.)",
107+
verbose_name="Целевая аудитория",
108+
help_text="Описание целевой аудитории проекта (до 500 симв.)",
109+
)
110+
trl = models.PositiveSmallIntegerField(
111+
verbose_name="TRL",
112+
help_text="Technology Readiness Level (от 1 до 9)",
113+
validators=[MinValueValidator(1), MaxValueValidator(9)],
114+
null=True,
115+
blank=True,
116+
)
117+
implementation_deadline = models.DateField(
118+
verbose_name="Общий срок реализации проекта",
119+
help_text="Дата, до которой планируется реализовать проект",
120+
null=True,
121+
blank=True,
118122
)
119123
problem = models.TextField(
120124
blank=True,

projects/views.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
PartnerProgramProject,
2424
PartnerProgramUserProfile,
2525
)
26-
from projects.constants import VERBOSE_STEPS
2726
from projects.exceptions import CollaboratorDoesNotExist
2827
from projects.filters import ProjectFilter
2928
from projects.helpers import (
@@ -322,16 +321,6 @@ def _collabs_queryset(
322321
)
323322

324323

325-
class ProjectSteps(APIView):
326-
permission_classes = [IsStaffOrReadOnly]
327-
328-
def get(self, request, format=None):
329-
"""
330-
Return a tuple of project steps.
331-
"""
332-
return Response(VERBOSE_STEPS)
333-
334-
335324
class AchievementList(generics.ListCreateAPIView):
336325
queryset = Achievement.objects.get_achievements_for_list_view()
337326
serializer_class = AchievementListSerializer

0 commit comments

Comments
 (0)