This commit is contained in:
Data-Name-ID
2024-04-01 18:00:52 +03:00
parent 1b84b746d1
commit 268a541466
14 changed files with 126 additions and 32 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from notifications import models from api.notifications import models
from notifications.forms import ( from api.notifications.forms import (
CreateNotificationAdminForm, CreateNotificationAdminForm,
EditNotificationAdminForm, EditNotificationAdminForm,
) )
+1 -1
View File
@@ -1,5 +1,5 @@
from django import forms from django import forms
from notifications.models import Notification from api.notifications.models import Notification
class EditNotificationAdminForm(forms.ModelForm): class EditNotificationAdminForm(forms.ModelForm):
@@ -0,0 +1,24 @@
# Generated by Django 5.0.3 on 2024-04-01 14:59
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Notification',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=150)),
('content', models.TextField(verbose_name='content')),
('read', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
),
]
@@ -0,0 +1,23 @@
# Generated by Django 5.0.3 on 2024-04-01 14:59
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('notifications', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name='notification',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL),
),
]
@@ -1,9 +1,7 @@
# Generated by Django 4.2.11 on 2024-03-31 19:06 # Generated by Django 5.0.3 on 2024-04-01 14:59
from django.conf import settings
import django.core.validators import django.core.validators
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
@@ -11,35 +9,28 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [
('users', '0002_rename_technologies_user_skills'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
] ]
operations = [ operations = [
migrations.CreateModel(
name='Vacancy',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='название вакансии')),
('start_date', models.DateField(blank=True, null=True, verbose_name='дата начала диапазона возраста участников')),
('end_date', models.DateField(blank=True, null=True, verbose_name='дата конец диапазона возраста участников')),
('skills', models.ManyToManyField(blank=True, to='users.skill', verbose_name='Технологии')),
('specialization', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.specialization', verbose_name='специализация')),
],
),
migrations.CreateModel( migrations.CreateModel(
name='Team', name='Team',
fields=[ fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(verbose_name='описание команды')), ('name', models.CharField(max_length=255)),
('name', models.CharField(max_length=255, verbose_name='название команды')), ('description', models.TextField()),
('avatar', models.ImageField(blank=True, upload_to='teams_avatars', verbose_name='аватарка')), ('avatar', models.ImageField(blank=True, upload_to='teams_avatars')),
('count_of_members', models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxLengthValidator(5)], verbose_name='количество участников')), ('count_of_members', models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxLengthValidator(5)], verbose_name='количество участников')),
('country', models.CharField(blank=True, max_length=255, verbose_name='страна')), ('country', models.CharField(blank=True, max_length=255, verbose_name='страна')),
('city', models.CharField(blank=True, max_length=255, verbose_name='город')), ('city', models.CharField(blank=True, max_length=255, verbose_name='город')),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='teams', to=settings.AUTH_USER_MODEL)), ],
('members', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='участники')), ),
('vacancies', models.ManyToManyField(to='teams.vacancy', verbose_name='вакансии')), migrations.CreateModel(
name='Vacancy',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('start_date', models.DateField(blank=True, null=True)),
('end_date', models.DateField(blank=True, null=True)),
], ],
), ),
] ]
@@ -0,0 +1,49 @@
# Generated by Django 5.0.3 on 2024-04-01 14:59
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('teams', '0001_initial'),
('users', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name='team',
name='author',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='teams', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='team',
name='members',
field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='vacancy',
name='skills',
field=models.ManyToManyField(blank=True, related_name='vacancies', to='users.skill'),
),
migrations.AddField(
model_name='vacancy',
name='specialization',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.specialization'),
),
migrations.AddField(
model_name='vacancy',
name='users',
field=models.ManyToManyField(blank=True, related_name='vacancies', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='team',
name='vacancies',
field=models.ManyToManyField(blank=True, to='teams.vacancy'),
),
]
-2
View File
@@ -44,13 +44,11 @@ class Team(models.Model):
members = models.ManyToManyField( members = models.ManyToManyField(
User, User,
blank=True, blank=True,
unique=True,
) )
vacancies = models.ManyToManyField( vacancies = models.ManyToManyField(
Vacancy, Vacancy,
blank=True, blank=True,
unique=True,
) )
avatar = models.ImageField( avatar = models.ImageField(
+1 -1
View File
@@ -1,5 +1,5 @@
from rest_framework import serializers from rest_framework import serializers
from teams.models import Team, Vacancy from api.teams.models import Team, Vacancy
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
+6 -1
View File
@@ -1,6 +1,6 @@
from django.urls import path from django.urls import path
from .views import AddUserToTeam from .views import AddUserToTeam, CreateVacancy
urlpatterns = [ urlpatterns = [
path( path(
@@ -8,4 +8,9 @@ urlpatterns = [
AddUserToTeam.as_view(), AddUserToTeam.as_view(),
name="add_user_to_team", name="add_user_to_team",
), ),
path(
"create_vacancy/",
CreateVacancy.as_view(),
name="create_vacancy",
),
] ]
+2 -2
View File
@@ -1,8 +1,8 @@
from rest_framework import status from rest_framework import status
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from teams.models import Team from api.teams.models import Team
from users.models import User from api.users.models import User
from rest_framework.generics import CreateAPIView from rest_framework.generics import CreateAPIView
from api.teams.serializers import TeamSerializer, VacancySerializer from api.teams.serializers import TeamSerializer, VacancySerializer
+1
View File
@@ -19,6 +19,7 @@ urlpatterns = [
namespace="rest_framework", namespace="rest_framework",
), ),
), ),
path("teams", include("api.teams.urls")),
# API documentation # API documentation
path( path(
"swagger<format>/", "swagger<format>/",
@@ -1,4 +1,4 @@
# Generated by Django 5.0.3 on 2024-04-01 13:44 # Generated by Django 5.0.3 on 2024-04-01 14:59
import api.users.models import api.users.models
import django.contrib.auth.models import django.contrib.auth.models
+3
View File
@@ -50,6 +50,9 @@ INSTALLED_APPS = [
# Developed apps # Developed apps
"api.ping.apps.PingConfig", "api.ping.apps.PingConfig",
"api.users.apps.UsersConfig", "api.users.apps.UsersConfig",
"api.teams.apps.TeamsConfig",
"api.core.apps.CoreConfig",
"api.notifications.apps.NotificationsConfig",
] ]
MIDDLEWARE = [ MIDDLEWARE = [