-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Pet-projects-CodePET/feature/add-project-…
…model feat:add project models
- Loading branch information
Showing
12 changed files
with
626 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from django.contrib import admin | ||
|
||
from .constants import LIST_PER_PAGE | ||
from .models import Level, Project, Skill, Specialist, Specialization, Status | ||
|
||
|
||
@admin.register(Skill) | ||
class SkillAdmin(admin.ModelAdmin): | ||
list_display = ("name",) | ||
search_fields = ("name",) | ||
|
||
|
||
@admin.register(Status) | ||
class StatusAdmin(admin.ModelAdmin): | ||
list_display = ("name",) | ||
search_fields = ("name",) | ||
|
||
|
||
@admin.register(Level) | ||
class LevelAdmin(admin.ModelAdmin): | ||
list_display = ("name",) | ||
search_fields = ("name",) | ||
|
||
|
||
@admin.register(Specialist) | ||
class SpecialistAdmin(admin.ModelAdmin): | ||
list_display = ("name", "specialization") | ||
list_filter = ("specialization",) | ||
search_fields = ("name", "specialization__name") | ||
|
||
|
||
@admin.register(Specialization) | ||
class SpecializationAdmin(admin.ModelAdmin): | ||
list_display = ("name",) | ||
search_fields = ("name",) | ||
|
||
|
||
@admin.register(Project) | ||
class ProjectAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
"name", | ||
"creator", | ||
"started", | ||
"ended", | ||
"contacts", | ||
"level", | ||
"busyness", | ||
"recruitment_status", | ||
"status", | ||
"direction", | ||
) | ||
list_filter = ("level", "busyness", "status") | ||
search_fields = ("name", "description", "purpose", "creator__username") | ||
list_per_page = LIST_PER_PAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ProjectConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "apps.project" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
BUSYNESS_CHOICES = [ | ||
(1, "10"), | ||
(2, "20"), | ||
(3, "30"), | ||
(4, "40"), | ||
] | ||
CONTACTS_LENGTH = 256 | ||
DIRECTION_CHOICES = [ | ||
(1, "Десктоп"), | ||
(2, "Веб"), | ||
(3, "Мобильная"), | ||
] | ||
DESCRIPTION_LENGTH = 3000 | ||
LIST_PER_PAGE = 10 | ||
NAME_LENGTH = 100 | ||
STATUS_CHOICES = [ | ||
(1, "Набор открыт"), | ||
(2, "Набор закрыт"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
# Generated by Django 5.0.1 on 2024-02-05 12:04 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Level", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField(max_length=100, verbose_name="Название"), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Уровень", | ||
"verbose_name_plural": "Уровни", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="Skill", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField(max_length=100, verbose_name="Название"), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Навык", | ||
"verbose_name_plural": "Навыки", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="Specialization", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField(max_length=100, verbose_name="Название"), | ||
), | ||
("quantity", models.PositiveSmallIntegerField()), | ||
], | ||
options={ | ||
"verbose_name": "Специальность", | ||
"verbose_name_plural": "Специальности", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="Status", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField(max_length=100, verbose_name="Название"), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Статус", | ||
"verbose_name_plural": "Статусы", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="Specialist", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField(max_length=100, verbose_name="Название"), | ||
), | ||
( | ||
"specialization", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="specialists", | ||
to="project.specialization", | ||
verbose_name="Специализация", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Специальность", | ||
"verbose_name_plural": "Специальности", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="Project", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("created", models.DateTimeField(auto_now_add=True)), | ||
("modified", models.DateTimeField(auto_now=True)), | ||
( | ||
"name", | ||
models.CharField( | ||
max_length=100, verbose_name="Название проекта" | ||
), | ||
), | ||
( | ||
"description", | ||
models.TextField( | ||
max_length=3000, verbose_name="Описание проекта" | ||
), | ||
), | ||
( | ||
"purpose", | ||
models.CharField( | ||
max_length=100, verbose_name="Цель проекта" | ||
), | ||
), | ||
( | ||
"started", | ||
models.DateField( | ||
blank=True, | ||
null=True, | ||
verbose_name="Дата начала проекта", | ||
), | ||
), | ||
( | ||
"ended", | ||
models.DateField( | ||
blank=True, | ||
null=True, | ||
verbose_name="Дата окончания проекта", | ||
), | ||
), | ||
( | ||
"busyness", | ||
models.CharField( | ||
choices=[ | ||
("full_time", "Полная занятость"), | ||
("part_time", "Частичная занятость"), | ||
], | ||
max_length=20, | ||
verbose_name="Занятость", | ||
), | ||
), | ||
( | ||
"creator", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="projects", | ||
to=settings.AUTH_USER_MODEL, | ||
verbose_name="Организатор", | ||
), | ||
), | ||
( | ||
"level", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="project.level", | ||
verbose_name="Уровень", | ||
), | ||
), | ||
( | ||
"skills", | ||
models.ManyToManyField( | ||
related_name="projects", | ||
to="project.skill", | ||
verbose_name="Навыки", | ||
), | ||
), | ||
( | ||
"specialists", | ||
models.ManyToManyField( | ||
related_name="projects", | ||
to="project.specialist", | ||
verbose_name="Специалисты", | ||
), | ||
), | ||
( | ||
"status", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="project.status", | ||
verbose_name="Статус", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Проект", | ||
"verbose_name_plural": "Проекты", | ||
"ordering": ("-created",), | ||
}, | ||
), | ||
] |
27 changes: 27 additions & 0 deletions
27
src/backend/apps/project/migrations/0002_alter_specialist_options_alter_project_busyness.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 5.0.1 on 2024-02-07 14:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="specialist", | ||
options={ | ||
"verbose_name": "Специалист", | ||
"verbose_name_plural": "Специалисты", | ||
}, | ||
), | ||
migrations.AlterField( | ||
model_name="project", | ||
name="busyness", | ||
field=models.IntegerField( | ||
choices=[(1, "Полная занятость"), (2, "Частичная занятость")], | ||
verbose_name="Занятость", | ||
), | ||
), | ||
] |
31 changes: 31 additions & 0 deletions
31
src/backend/apps/project/migrations/0003_project_recruitment_status_alter_project_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 5.0.1 on 2024-02-07 15:28 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("project", "0002_alter_specialist_options_alter_project_busyness"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="project", | ||
name="recruitment_status", | ||
field=models.IntegerField( | ||
choices=[(1, "Набор открыт"), (2, "Набор закрыт")], | ||
default=1, | ||
verbose_name="Статус набора участников", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="project", | ||
name="status", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="project.status", | ||
verbose_name="Статус проекта", | ||
), | ||
), | ||
] |
Oops, something went wrong.