Skip to content

Commit

Permalink
Profile phone number and parent phone number null=True and not requir…
Browse files Browse the repository at this point in the history
…ed on create
  • Loading branch information
michalmasrna1 committed Nov 23, 2024
1 parent b9ba5cc commit 4c824df
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.15 on 2024-11-23 23:11

import base.models
import competition.models
import django.core.files.storage
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('competition', '0002_initial'),
]

operations = [
migrations.AlterField(
model_name='solution',
name='corrected_solution',
field=base.models.RestrictedFileField(blank=True, storage=django.core.files.storage.FileSystemStorage(base_url='/protected/', location='/home/michal/Documents/kody/STROM/webstrom-backend/protected_media/'), upload_to=competition.models.get_corrected_solution_path, verbose_name='opravené riešenie'),
),
migrations.AlterField(
model_name='solution',
name='solution',
field=base.models.RestrictedFileField(blank=True, storage=django.core.files.storage.FileSystemStorage(base_url='/protected/', location='/home/michal/Documents/kody/STROM/webstrom-backend/protected_media/'), upload_to=competition.models.get_solution_path, verbose_name='účastnícke riešenie'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.15 on 2024-11-23 23:11

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('personal', '0002_initial'),
]

operations = [
migrations.AlterField(
model_name='profile',
name='parent_phone',
field=models.CharField(blank=True, help_text='Telefonné číslo v medzinárodnom formáte (napr. +421 123 456 789).', max_length=32, null=True, validators=[django.core.validators.RegexValidator(message='Zadaj telefónne číslo vo formáte +421 123 456 789 alebo 0912 345 678.', regex='^(\\+\\d{1,3}\\d{9})$')], verbose_name='telefónne číslo na rodiča'),
),
migrations.AlterField(
model_name='profile',
name='phone',
field=models.CharField(blank=True, help_text='Telefonné číslo v medzinárodnom formáte (napr. +421 123 456 789).', max_length=32, null=True, validators=[django.core.validators.RegexValidator(message='Zadaj telefónne číslo vo formáte +421 123 456 789 alebo 0912 345 678.', regex='^(\\+\\d{1,3}\\d{9})$')], verbose_name='telefónne číslo'),
),
]
4 changes: 2 additions & 2 deletions personal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ class Meta:
verbose_name='rok maturity')

phone = models.CharField(
verbose_name='telefónne číslo', max_length=32, blank=True,
verbose_name='telefónne číslo', max_length=32, blank=True, null=True,
validators=[phone_number_validator],
help_text='Telefonné číslo v medzinárodnom formáte (napr. +421 123 456 789).')

parent_phone = models.CharField(
verbose_name='telefónne číslo na rodiča', max_length=32, blank=True,
verbose_name='telefónne číslo na rodiča', max_length=32, blank=True, null=True,
validators=[phone_number_validator],
help_text='Telefonné číslo v medzinárodnom formáte (napr. +421 123 456 789).')

Expand Down
4 changes: 2 additions & 2 deletions personal/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def create(self, validated_data):
last_name=validated_data['last_name'],
school=school,
year_of_graduation=grade.get_year_of_graduation_by_date(),
phone=validated_data['phone'],
parent_phone=validated_data['parent_phone']
phone=validated_data.get('phone', None),
parent_phone=validated_data.get('parent_phone', None),
)


Expand Down

0 comments on commit 4c824df

Please sign in to comment.