Added updatePassword view, added exception handler, added friends view

This commit is contained in:
ITQ
2024-03-03 18:13:59 +03:00
parent 18f66344bb
commit 20e6e512d2
9 changed files with 169 additions and 57 deletions
@@ -1,8 +1,9 @@
# Generated by Django 4.2.10 on 2024-03-03 06:12
# Generated by Django 4.2.10 on 2024-03-03 15:01
import api.users.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
@@ -13,6 +14,13 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='Friendship',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('addedAt', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Profile',
fields=[
@@ -22,9 +30,19 @@ class Migration(migrations.Migration):
('password', models.CharField(max_length=100, validators=[django.core.validators.RegexValidator('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{6,100}$')])),
('countryCode', models.CharField(max_length=2, validators=[django.core.validators.RegexValidator('[a-zA-Z]{2}'), api.users.validators.CountryCodeValidator()])),
('isPublic', models.BooleanField()),
('phone', models.CharField(blank=True, max_length=20, null=True, validators=[django.core.validators.MaxLengthValidator(20), django.core.validators.RegexValidator('\\+[\\d]+')])),
('image', models.URLField(blank=True, null=True)),
('friends', models.ManyToManyField(blank=True, to='users.profile')),
('phone', models.CharField(max_length=20, null=True, validators=[django.core.validators.MaxLengthValidator(20), django.core.validators.RegexValidator('\\+[\\d]+')])),
('image', models.URLField(null=True)),
('friends', models.ManyToManyField(blank=True, through='users.Friendship', to='users.profile')),
],
),
migrations.AddField(
model_name='friendship',
name='from_profile',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='friendship_from', to='users.profile'),
),
migrations.AddField(
model_name='friendship',
name='to_profile',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='friendship_to', to='users.profile'),
),
]