Skip to content

Commit eb30bdb

Browse files
authored
Merge pull request #561 from PROCOLLAB-github/release/user-profile-validation-fixes
Мелкие правки профиля пользователя
2 parents bdacb1d + 2d8d986 commit eb30bdb

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

news/mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class NewsMapping:
1414
@classmethod
1515
def get_name(cls, content_object) -> str:
1616
if isinstance(content_object, User):
17-
f"{content_object.first_name} {content_object.last_name}"
17+
return f"{content_object.first_name} {content_object.last_name}"
1818
if isinstance(content_object, Project) or isinstance(
1919
content_object, PartnerProgram
2020
):

users/serializers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,11 @@ class Meta:
446446

447447
class UserProgramsSerializer(serializers.ModelSerializer):
448448
year = serializers.SerializerMethodField()
449+
logo = serializers.CharField(source="image_address", read_only=True)
449450

450451
class Meta:
451452
model = PartnerProgram
452-
fields = ["id", "tag", "name", "year"]
453+
fields = ["id", "tag", "name", "year", "logo"]
453454

454455
def get_year(self, program: PartnerProgram) -> int | None:
455456
user_program_profile = PartnerProgramUserProfile.objects.filter(

users/validators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ def specialization_exists_validator(pk: int):
4545
def user_experience_years_range_validator(value: int):
4646
"""
4747
Check range for choice entry/completion year.
48-
(2000 - `now.year`)
48+
(1971 - `now.year`)
4949
"""
50-
if value not in range(2000, timezone.now().year + 1):
50+
if value not in range(1971, timezone.now().year + 1):
5151
raise DjangoValidationError(
52-
f"Год должен быть в диапазоне 2000 - {timezone.now().year}"
52+
f"Год должен быть в диапазоне 1971 - {timezone.now().year}"
5353
)
5454

5555

0 commit comments

Comments
 (0)