Skip to content

Commit 084e3f5

Browse files
committed
PRO-449: Remove organization user field
Старое поле удалено из профиля пользателя, прочие сущности адаптированы под новое поле
1 parent 1f0d647 commit 084e3f5

9 files changed

Lines changed: 22 additions & 144 deletions

File tree

core/management/commands/__init__.py

Whitespace-only changes.

core/management/commands/migrate_education.py

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

core/management/commands/reverse_migrate_education.py

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

log/migrated_users.json

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

users/admin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ class CustomUserAdmin(admin.ModelAdmin):
9494
"status",
9595
"city",
9696
"region",
97-
"organization", # TODO need to be removed in future.
9897
"speciality",
9998
"v2_speciality",
10099
"key_skills",
@@ -264,6 +263,7 @@ def get_export_users_emails(self, users):
264263
"collaborations__project",
265264
"collaborations__project__industry",
266265
"skills__skill",
266+
"education",
267267
)
268268
)
269269
little_mans = users.filter(birthday__lte=date_limit_18)
@@ -290,7 +290,7 @@ def get_export_users_emails(self, users):
290290
baby.first_name + " " + baby.last_name,
291291
today.year - baby.birthday.year,
292292
", ".join(interests),
293-
baby.organization,
293+
"; ".join(baby.education.values_list("organization_name", flat=True)),
294294
baby.v2_speciality if baby.v2_speciality else baby.speciality,
295295
baby.email,
296296
]
@@ -306,7 +306,7 @@ def get_export_users_emails(self, users):
306306
big_man.first_name + " " + big_man.last_name,
307307
today.year - big_man.birthday.year,
308308
", ".join(industry_names),
309-
big_man.organization,
309+
"; ".join(big_man.education.values_list("organization_name", flat=True)),
310310
big_man.v2_speciality
311311
if big_man.v2_speciality
312312
else big_man.speciality,

users/filters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class UserFilter(filters.FilterSet):
1919
2020
Parameters to filter by:
2121
first_name (str), last_name (str), patronymic (str),
22-
city (str), region (str), organization (str), about_me__contains (str),
22+
city (str), region (str), about_me__contains (str),
2323
useful_to_project__contains (str)
2424
2525
Examples:
@@ -121,7 +121,6 @@ class Meta:
121121
"patronymic",
122122
"city",
123123
"region",
124-
"organization", # TODO need to be removed in future.
125124
"user_type",
126125
"speciality",
127126
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.11 on 2024-10-25 09:18
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("users", "0051_alter_usereducation_options_customuser_phone_number_and_more"),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name="customuser",
15+
name="organization",
16+
),
17+
]

users/models.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class CustomUser(AbstractUser):
4646
status: CharField instance notifies about the user's status.
4747
region: CharField instance the user's name region.
4848
city: CharField instance the user's name city.
49-
organization: CharField instance the user's place of study or work.
5049
speciality: CharField instance the user's specialty.
5150
datetime_updated: A DateTimeField indicating date of update.
5251
datetime_created: A DateTimeField indicating date of creation.
@@ -104,13 +103,6 @@ class CustomUser(AbstractUser):
104103
verbose_name="Номер телефона",
105104
help_text="Пример: +7 XXX XX-XX-XX | +7XXXXXXXXX | +7 (XXX) XX-XX-XX"
106105
)
107-
# TODO need to be removed in future `organization` -> `education`.
108-
organization = models.CharField(
109-
max_length=255,
110-
null=True,
111-
blank=True,
112-
help_text="Устаревшее поле -> UserEducation",
113-
)
114106
v2_speciality = models.ForeignKey(
115107
on_delete=models.SET_NULL,
116108
null=True,
@@ -179,7 +171,7 @@ def calculate_ordering_score(self) -> int:
179171
if self.city:
180172
score += 4
181173
# TODO need to be removed in future.
182-
if self.organization or self.education.all().exists():
174+
if self.education.all().exists():
183175
score += 6
184176
if self.speciality:
185177
score += 7

users/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ class Meta:
428428
"speciality",
429429
"v2_speciality",
430430
"v2_speciality_id",
431-
"organization", # TODO need to be removed in future.
432431
"education",
433432
"work_experience",
434433
"user_languages",

0 commit comments

Comments
 (0)