Skip to content

Commit

Permalink
Merge pull request #231 from ZdruzenieSTROM/Remove-nickname
Browse files Browse the repository at this point in the history
Remove nickname
  • Loading branch information
kovacspe authored Nov 10, 2023
2 parents dca3b43 + 57a27c7 commit 6d02b44
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 48 deletions.
1 change: 0 additions & 1 deletion base/management/commands/load_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def _load_users(self, conn, school_id_map):
first_name=user['first_name'],
last_name=user['last_name'],
user=new_user,
nickname=user['username'],
school=school_id_map.get(
user['school_id'], School.objects.get_unspecified_value()),
year_of_graduation=grade,
Expand Down
1 change: 0 additions & 1 deletion competition/fixtures/sources/generate_users_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def generate_profile(pk, user, year, school):
"user": user,
"first_name": "Ucastnik ",
"last_name": f'Priezvisko{user}',
"nickname": f'Prezyvka{user}',
"school": "000160997",
"year_of_graduation": year,
"phone": "+421912345678",
Expand Down
3 changes: 0 additions & 3 deletions personal/fixtures/profiles.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"user": 20,
"first_name": "\ud83e\udd89",
"last_name": "\ud83e\udd89",
"nickname": "\ud83e\udd89",
"school": 0,
"year_of_graduation": 8389,
"phone": "\ud83e\udd89",
Expand All @@ -33,7 +32,6 @@
"user": 42,
"first_name": "Mat",
"last_name": "Krajin\u00e1rsky \u2013 Architekt",
"nickname": "",
"school": 598071,
"year_of_graduation": 42,
"phone": "00420420420420"
Expand All @@ -46,7 +44,6 @@
"user": 17,
"first_name": "\ud83d\ude65\ud83d\udd4f\ud83d\udd45\ud83d\udd79\ud83d\udda8\ud83d\uddf0\ud83d\udde2\ud83d\udddd\ud83d\udddc\ud83d\uddce\ud83d\uddd1\ud83d\udde1\ud83d\uddff\ud83d\uddfa\ud83e\udd49\ud83e\udd36\ud83e\udd00\ud83e\udd68\ud83e\uddc1\ud83d\ude67",
"last_name": "\ud83d\ude6c\ud83e\udeb5\ud83e\ude78\ud83e\uded5\ud83e\uded3\ud83e\ude90\ud83e\ude80\ud83e\ude86\ud83e\udea6\ud83e\udec0\ud83e\udec2\ud83d\ude6e",
"nickname": "\ud83d\ude75////////\ud83d\ude75\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude7f\ud83d\ude75",
"school": 36080501,
"year_of_graduation": 0,
"phone": "\ud83d\ude3d"
Expand Down
30 changes: 0 additions & 30 deletions personal/fixtures/profiles_more.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"user": 48,
"first_name": "Ucastnik",
"last_name": "Priezvisko48",
"nickname": "Prezyvka48",
"school": "000160997",
"year_of_graduation": 2022,
"phone": "+421912345678",
Expand All @@ -20,7 +19,6 @@
"user": 49,
"first_name": "Ucastnik",
"last_name": "Priezvisko49",
"nickname": "Prezyvka49",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -34,7 +32,6 @@
"user": 50,
"first_name": "Ucastnik",
"last_name": "Priezvisko50",
"nickname": "Prezyvka50",
"school": "000160997",
"year_of_graduation": 2028,
"phone": "+421912345678",
Expand All @@ -48,7 +45,6 @@
"user": 51,
"first_name": "Ucastnik",
"last_name": "Priezvisko51",
"nickname": "Prezyvka51",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -62,7 +58,6 @@
"user": 52,
"first_name": "Ucastnik",
"last_name": "Priezvisko52",
"nickname": "Prezyvka52",
"school": "000160997",
"year_of_graduation": 2024,
"phone": "+421912345678",
Expand All @@ -76,7 +71,6 @@
"user": 53,
"first_name": "Ucastnik",
"last_name": "Priezvisko53",
"nickname": "Prezyvka53",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -90,7 +84,6 @@
"user": 54,
"first_name": "Ucastnik",
"last_name": "Priezvisko54",
"nickname": "Prezyvka54",
"school": "000160997",
"year_of_graduation": 2027,
"phone": "+421912345678",
Expand All @@ -104,7 +97,6 @@
"user": 55,
"first_name": "Ucastnik",
"last_name": "Priezvisko55",
"nickname": "Prezyvka55",
"school": "000160997",
"year_of_graduation": 2022,
"phone": "+421912345678",
Expand All @@ -118,7 +110,6 @@
"user": 56,
"first_name": "Ucastnik",
"last_name": "Priezvisko56",
"nickname": "Prezyvka56",
"school": "000160997",
"year_of_graduation": 2021,
"phone": "+421912345678",
Expand All @@ -132,7 +123,6 @@
"user": 57,
"first_name": "Ucastnik",
"last_name": "Priezvisko57",
"nickname": "Prezyvka57",
"school": "000160997",
"year_of_graduation": 2029,
"phone": "+421912345678",
Expand All @@ -146,7 +136,6 @@
"user": 58,
"first_name": "Ucastnik",
"last_name": "Priezvisko58",
"nickname": "Prezyvka58",
"school": "000160997",
"year_of_graduation": 2022,
"phone": "+421912345678",
Expand All @@ -160,7 +149,6 @@
"user": 59,
"first_name": "Ucastnik",
"last_name": "Priezvisko59",
"nickname": "Prezyvka59",
"school": "000160997",
"year_of_graduation": 2021,
"phone": "+421912345678",
Expand All @@ -174,7 +162,6 @@
"user": 60,
"first_name": "Ucastnik",
"last_name": "Priezvisko60",
"nickname": "Prezyvka60",
"school": "000160997",
"year_of_graduation": 2024,
"phone": "+421912345678",
Expand All @@ -188,7 +175,6 @@
"user": 61,
"first_name": "Ucastnik",
"last_name": "Priezvisko61",
"nickname": "Prezyvka61",
"school": "000160997",
"year_of_graduation": 2020,
"phone": "+421912345678",
Expand All @@ -202,7 +188,6 @@
"user": 62,
"first_name": "Ucastnik",
"last_name": "Priezvisko62",
"nickname": "Prezyvka62",
"school": "000160997",
"year_of_graduation": 2024,
"phone": "+421912345678",
Expand All @@ -216,7 +201,6 @@
"user": 63,
"first_name": "Ucastnik",
"last_name": "Priezvisko63",
"nickname": "Prezyvka63",
"school": "000160997",
"year_of_graduation": 2026,
"phone": "+421912345678",
Expand All @@ -230,7 +214,6 @@
"user": 64,
"first_name": "Ucastnik",
"last_name": "Priezvisko64",
"nickname": "Prezyvka64",
"school": "000160997",
"year_of_graduation": 2029,
"phone": "+421912345678",
Expand All @@ -244,7 +227,6 @@
"user": 65,
"first_name": "Ucastnik",
"last_name": "Priezvisko65",
"nickname": "Prezyvka65",
"school": "000160997",
"year_of_graduation": 2028,
"phone": "+421912345678",
Expand All @@ -258,7 +240,6 @@
"user": 66,
"first_name": "Ucastnik",
"last_name": "Priezvisko66",
"nickname": "Prezyvka66",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -272,7 +253,6 @@
"user": 67,
"first_name": "Ucastnik",
"last_name": "Priezvisko67",
"nickname": "Prezyvka67",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -286,7 +266,6 @@
"user": 68,
"first_name": "Ucastnik",
"last_name": "Priezvisko68",
"nickname": "Prezyvka68",
"school": "000160997",
"year_of_graduation": 2023,
"phone": "+421912345678",
Expand All @@ -300,7 +279,6 @@
"user": 69,
"first_name": "Ucastnik",
"last_name": "Priezvisko69",
"nickname": "Prezyvka69",
"school": "000160997",
"year_of_graduation": 2024,
"phone": "+421912345678",
Expand All @@ -314,7 +292,6 @@
"user": 70,
"first_name": "Ucastnik",
"last_name": "Priezvisko70",
"nickname": "Prezyvka70",
"school": "000160997",
"year_of_graduation": 2028,
"phone": "+421912345678",
Expand All @@ -328,7 +305,6 @@
"user": 71,
"first_name": "Ucastnik",
"last_name": "Priezvisko71",
"nickname": "Prezyvka71",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -342,7 +318,6 @@
"user": 72,
"first_name": "Ucastnik",
"last_name": "Priezvisko72",
"nickname": "Prezyvka72",
"school": "000160997",
"year_of_graduation": 2025,
"phone": "+421912345678",
Expand All @@ -356,7 +331,6 @@
"user": 73,
"first_name": "Ucastnik",
"last_name": "Priezvisko73",
"nickname": "Prezyvka73",
"school": "000160997",
"year_of_graduation": 2020,
"phone": "+421912345678",
Expand All @@ -370,7 +344,6 @@
"user": 74,
"first_name": "Ucastnik",
"last_name": "Priezvisko74",
"nickname": "Prezyvka74",
"school": "000160997",
"year_of_graduation": 2024,
"phone": "+421912345678",
Expand All @@ -384,7 +357,6 @@
"user": 75,
"first_name": "Ucastnik",
"last_name": "Priezvisko75",
"nickname": "Prezyvka75",
"school": "000160997",
"year_of_graduation": 2023,
"phone": "+421912345678",
Expand All @@ -398,7 +370,6 @@
"user": 76,
"first_name": "Ucastnik",
"last_name": "Priezvisko76",
"nickname": "Prezyvka76",
"school": "000160997",
"year_of_graduation": 2022,
"phone": "+421912345678",
Expand All @@ -412,7 +383,6 @@
"user": 77,
"first_name": "Ucastnik",
"last_name": "Priezvisko77",
"nickname": "Prezyvka77",
"school": "000160997",
"year_of_graduation": 2029,
"phone": "+421912345678",
Expand Down
3 changes: 0 additions & 3 deletions personal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ class Meta:
related_name='profile'
)

nickname = models.CharField(
verbose_name='prezývka', max_length=32, blank=True, )

school = models.ForeignKey(
School, on_delete=models.SET(School.objects.get_unspecified_value),
verbose_name='škola')
Expand Down
10 changes: 4 additions & 6 deletions personal/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ProfileSerializer(serializers.ModelSerializer):

class Meta:
model = Profile
fields = ['grade_name', 'id', 'email', 'first_name', 'last_name', 'nickname', 'school',
fields = ['grade_name', 'id', 'email', 'first_name', 'last_name', 'school',
'phone', 'parent_phone', 'gdpr', 'grade', 'is_student', 'has_school', 'school_id']
read_only_fields = ['grade_name', 'id', 'first_name', 'last_name',
'email', 'is_student', 'has_school', 'school'] # 'year_of_graduation',
Expand Down Expand Up @@ -99,7 +99,6 @@ def create(self, validated_data):
return Profile.objects.create(
first_name=validated_data['first_name'],
last_name=validated_data['last_name'],
nickname=validated_data['nickname'],
school=validated_data['school'],
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=validated_data['phone'],
Expand All @@ -114,7 +113,7 @@ class ProfileCreateSerializer(serializers.ModelSerializer):

class Meta:
model = Profile
fields = ['first_name', 'last_name', 'nickname', 'school',
fields = ['first_name', 'last_name', 'school',
'phone', 'parent_phone', 'gdpr', 'grade']
read_only_fields = ['grade']
extra_kwargs = {
Expand All @@ -140,7 +139,6 @@ def create(self, validated_data):
return Profile.objects.create(
first_name=validated_data['first_name'],
last_name=validated_data['last_name'],
nickname=validated_data['nickname'],
school=validated_data['school'],
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=validated_data['phone'],
Expand All @@ -153,7 +151,7 @@ def create(self, validated_data):
class ProfileShortSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = ['first_name', 'last_name', 'nickname']
fields = ['first_name', 'last_name']


@ts_interface(context='personal')
Expand All @@ -170,4 +168,4 @@ class Meta:
model = Profile
fields = ['school_name', 'school_abbreviation',
'school_street', 'school_city', 'school_zip_code',
'first_name', 'last_name', 'nickname', 'email']
'first_name', 'last_name', 'email']
2 changes: 1 addition & 1 deletion personal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProfileViewSet(viewsets.ModelViewSet):
filterset_fields = ['school', 'year_of_graduation', ]
permission_classes = [IsAdminUser]
filter_backends = [DjangoFilterBackend, SearchFilter]
search_fields = ['first_name', 'last_name', 'nickname']
search_fields = ['first_name', 'last_name']

# pylint: disable=inconsistent-return-statements
@action(methods=['get', 'put'], detail=False, permission_classes=[IsAuthenticated])
Expand Down
3 changes: 0 additions & 3 deletions user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ def update(self, instance, validated_data):

# Update Profile
# Nie všetky polia v modeloch User a Profile sú editovateľné cez API.
instance.profile.nickname = profile_data.get(
'nickname', instance.profile.nickname)
instance.profile.phone = profile_data.get(
'phone', instance.profile.phone)
instance.profile.parent_phone = profile_data.get(
Expand Down Expand Up @@ -186,7 +184,6 @@ def save(self, request):
Profile.objects.create(user=user,
first_name=profile_data['first_name'],
last_name=profile_data['last_name'],
nickname=profile_data['nickname'],
school=profile_data['school'],
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=profile_data['phone'],
Expand Down

0 comments on commit 6d02b44

Please sign in to comment.