[fix]
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.contrib import admin
|
||||
from notifications import models
|
||||
from notifications.forms import (
|
||||
from api.notifications import models
|
||||
from api.notifications.forms import (
|
||||
CreateNotificationAdminForm,
|
||||
EditNotificationAdminForm,
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django import forms
|
||||
from notifications.models import Notification
|
||||
from api.notifications.models import Notification
|
||||
|
||||
|
||||
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
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@@ -11,35 +9,28 @@ class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('users', '0002_rename_technologies_user_skills'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
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(
|
||||
name='Team',
|
||||
fields=[
|
||||
('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, verbose_name='название команды')),
|
||||
('avatar', models.ImageField(blank=True, upload_to='teams_avatars', verbose_name='аватарка')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('description', models.TextField()),
|
||||
('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='количество участников')),
|
||||
('country', 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'),
|
||||
),
|
||||
]
|
||||
@@ -44,13 +44,11 @@ class Team(models.Model):
|
||||
members = models.ManyToManyField(
|
||||
User,
|
||||
blank=True,
|
||||
unique=True,
|
||||
)
|
||||
|
||||
vacancies = models.ManyToManyField(
|
||||
Vacancy,
|
||||
blank=True,
|
||||
unique=True,
|
||||
)
|
||||
|
||||
avatar = models.ImageField(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from rest_framework import serializers
|
||||
from teams.models import Team, Vacancy
|
||||
from api.teams.models import Team, Vacancy
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import AddUserToTeam
|
||||
from .views import AddUserToTeam, CreateVacancy
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
@@ -8,4 +8,9 @@ urlpatterns = [
|
||||
AddUserToTeam.as_view(),
|
||||
name="add_user_to_team",
|
||||
),
|
||||
path(
|
||||
"create_vacancy/",
|
||||
CreateVacancy.as_view(),
|
||||
name="create_vacancy",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from rest_framework import status
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from teams.models import Team
|
||||
from users.models import User
|
||||
from api.teams.models import Team
|
||||
from api.users.models import User
|
||||
from rest_framework.generics import CreateAPIView
|
||||
from api.teams.serializers import TeamSerializer, VacancySerializer
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ urlpatterns = [
|
||||
namespace="rest_framework",
|
||||
),
|
||||
),
|
||||
path("teams", include("api.teams.urls")),
|
||||
# API documentation
|
||||
path(
|
||||
"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 django.contrib.auth.models
|
||||
|
||||
@@ -50,6 +50,9 @@ INSTALLED_APPS = [
|
||||
# Developed apps
|
||||
"api.ping.apps.PingConfig",
|
||||
"api.users.apps.UsersConfig",
|
||||
"api.teams.apps.TeamsConfig",
|
||||
"api.core.apps.CoreConfig",
|
||||
"api.notifications.apps.NotificationsConfig",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
Reference in New Issue
Block a user