Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gdpr field #304

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions base/management/commands/load_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import pytz
import unidecode
from allauth.account.models import EmailAddress
from competition.models import (Competition, EventRegistration, Grade, Problem,
Semester, Series, Solution)
from competition.utils import get_school_year_by_date
from django.core.management import BaseCommand
from django.db.models import Q
from django.forms.models import model_to_dict
from django.utils.dateparse import parse_datetime

from competition.models import (Competition, EventRegistration, Grade, Problem,
Semester, Series, Solution)
from competition.utils import get_school_year_by_date
from personal.models import Profile, School
from user.models import User

Expand Down Expand Up @@ -244,8 +245,7 @@ def _load_users(self, conn, school_id_map):
user['school_id'], School.objects.get_unspecified_value()),
year_of_graduation=grade,
phone=user['phone_number'] or '',
parent_phone=user['parent_phone_number'] or '',
gdpr=True
parent_phone=user['parent_phone_number'] or ''
)
user_id_mapping[user['id']] = profile
return user_id_mapping
Expand Down
8 changes: 3 additions & 5 deletions personal/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from base.managers import UnspecifiedValueManager
from base.validators import phone_number_validator
from django.apps import apps
from django.conf import settings
from django.db import models

from base.managers import UnspecifiedValueManager
from base.validators import phone_number_validator


class County(models.Model):
class Meta:
Expand Down Expand Up @@ -107,9 +108,6 @@ class Meta:
validators=[phone_number_validator],
help_text='Telefonné číslo v medzinárodnom formáte (napr. +421 123 456 789).')

gdpr = models.BooleanField(
verbose_name='súhlas so spracovaním osobných údajov', default=False)

@property
def grade(self):
return apps.get_model('competition', 'Grade').get_grade_by_year_of_graduation(
Expand Down
8 changes: 3 additions & 5 deletions personal/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ProfileSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = ['grade_name', 'id', 'email', 'first_name', 'last_name', 'school',
'phone', 'parent_phone', 'gdpr', 'grade', 'is_student', 'has_school', 'school_id']
'phone', 'parent_phone', '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 @@ -102,8 +102,7 @@ def create(self, validated_data):
school=validated_data['school'],
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=validated_data['phone'],
parent_phone=validated_data['parent_phone'],
gdpr=validated_data['gdpr']
parent_phone=validated_data['parent_phone']
)


Expand All @@ -114,7 +113,7 @@ class ProfileCreateSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = ['first_name', 'last_name', 'school',
'phone', 'parent_phone', 'gdpr', 'grade']
'phone', 'parent_phone', 'grade']
read_only_fields = ['grade']
extra_kwargs = {
'grade': {
Expand Down Expand Up @@ -143,7 +142,6 @@ def create(self, validated_data):
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=validated_data['phone'],
parent_phone=validated_data['parent_phone'],
gdpr=validated_data['gdpr']
)


Expand Down
15 changes: 2 additions & 13 deletions user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ def update(self, instance, validated_data):
'last_name', instance.profile.last_name)
instance.profile.parent_phone = profile_data.get(
'parent_phone', instance.profile.parent_phone)
instance.profile.gdpr = profile_data.get(
'gdpr', instance.profile.gdpr)
instance.profile.school = profile_data.get(
'school', instance.profile.school)
instance.profile.year_of_graduation = profile_data.get(
Expand Down Expand Up @@ -183,15 +181,6 @@ def validate_email(self, email):
def validate_password1(self, password):
return get_adapter().clean_password(password)

def validate_profile(self, profile):
'''
check ci je gdpr zaskrtnute
'''
if not profile['gdpr']:
raise serializers.ValidationError(
'Musíš podvrdiť, že si si vedomý spracovania osobných údajov.')
return profile

def validate(self, attrs):
if attrs['password1'] != attrs['password2']:
raise serializers.ValidationError("Zadané heslá sa nezhodujú.")
Expand Down Expand Up @@ -224,8 +213,8 @@ def save(self, request):
school=profile_data['school'],
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=profile_data['phone'],
parent_phone=profile_data['parent_phone'],
gdpr=profile_data['gdpr'])
parent_phone=profile_data['parent_phone']
)

self.handle_other_school(profile_data['school'])
setup_user_email(request, user, [])
Expand Down
Loading