Skip to content

Commit 0b8e284

Browse files
authored
Merge pull request #517 from PROCOLLAB-github/dev
Изменения в административную панель в части специлизаций
2 parents 770ffd4 + 55dec40 commit 0b8e284

2 files changed

Lines changed: 29 additions & 16 deletions

File tree

.github/workflows/django-test.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ name: Django CI
33
on:
44
push:
55
branches:
6-
- '*' # matches every branch that doesn't contain a '/'
7-
- '*/*' # matches every branch containing a single '/'
8-
- '**' # matches every branch
6+
- '**'
97

108
jobs:
119
django-test:
@@ -18,32 +16,33 @@ jobs:
1816
with:
1917
python-version: 3.11
2018

21-
- name: cache poetry install
19+
- name: Cache Poetry
2220
uses: actions/cache@v4
2321
with:
2422
path: ~/.local
25-
key: poetry-1.2.2-0
23+
key: poetry-1.2.2-${{ hashFiles('**/poetry.lock') }}
2624

2725
- uses: snok/install-poetry@v1
2826
with:
2927
version: 1.2.2
3028
virtualenvs-create: true
3129
virtualenvs-in-project: true
3230

33-
- name: cache deps
31+
- name: Cache dependencies
3432
id: cache-deps
3533
uses: actions/cache@v4
3634
with:
3735
path: .venv
3836
key: pydeps-${{ hashFiles('**/poetry.lock') }}
37+
restore-keys: |
38+
pydeps-
3939
40-
- run: poetry install --no-root
41-
if: steps.cache-deps.outputs.cache-hit != 'true'
42-
43-
# install setuptools
44-
- run: poetry run pip install setuptools
40+
- name: Install dependencies
41+
run: poetry install
4542

4643
- name: Run tests
47-
run: poetry run python manage.py test
44+
run: poetry run python manage.py test --verbosity=2
4845
env:
49-
DEBUG: True
46+
DEBUG: True
47+
DJANGO_SETTINGS_MODULE: procollab.settings
48+
PYTHONUNBUFFERED: 1

core/admin.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
from core.models import (
55
Like,
6-
View,
76
Link,
8-
Specialization,
9-
SpecializationCategory,
107
Skill,
118
SkillCategory,
129
SkillToObject,
10+
Specialization,
11+
SpecializationCategory,
12+
View,
1313
)
1414

1515

@@ -69,13 +69,26 @@ class SpecializationAdmin(admin.ModelAdmin):
6969
"id",
7070
"name",
7171
"category",
72+
"category_id",
7273
)
7374
list_display_links = (
7475
"id",
7576
"name",
77+
"category_id",
7678
)
7779

7880

81+
class SpecializationInline(admin.TabularInline):
82+
model = Specialization
83+
extra = 0
84+
fields = ("name",)
85+
show_change_link = True
86+
can_delete = False
87+
88+
def has_change_permission(self, request, obj=None):
89+
return False
90+
91+
7992
@admin.register(SpecializationCategory)
8093
class SpecializationCategoryAdmin(admin.ModelAdmin):
8194
list_display = (
@@ -86,6 +99,7 @@ class SpecializationCategoryAdmin(admin.ModelAdmin):
8699
"id",
87100
"name",
88101
)
102+
inlines = [SpecializationInline]
89103

90104

91105
@admin.register(SkillToObject)

0 commit comments

Comments
 (0)