Установлен и настроен django-fsm==3.0.1 для управления жизненным циклом документов.
Изменения в модели (documents/models.py):
- Добавлено FSM поле 'status' с 6 состояниями:
* draft (черновик) - по умолчанию
* in_review (на рассмотрении)
* approved (одобрен)
* published (опубликован)
* archived (архивирован)
* rejected (отклонен)
- Созданы transitions (переходы между состояниями):
* submit_for_review(): draft → in_review
* approve(): in_review → approved
* reject(): in_review → rejected
* publish(): approved → published (с отправкой уведомлений)
* return_to_draft(): draft/in_review → draft
* archive(): published → archived
* unarchive(): archived → published
Изменения в админке (documents/admin.py):
- Добавлен status_badge() с цветовыми индикаторами статусов
- Добавлен available_transitions() - список доступных переходов
- Поле status добавлено в list_display и fieldsets
- Фильтрация по статусам в list_filter
Изменения в API (api/v1/documents/):
- Добавлены поля status и status_code в DocumentReadSerializer
- Созданы actions для всех FSM transitions:
* POST /api/v1/documents/{id}/submit-for-review/
* POST /api/v1/documents/{id}/approve/
* POST /api/v1/documents/{id}/reject/
* POST /api/v1/documents/{id}/publish/
* POST /api/v1/documents/{id}/return-to-draft/
* POST /api/v1/documents/{id}/archive/
* POST /api/v1/documents/{id}/unarchive/
Миграция:
- Создана 0006_add_fsm_status.py
- Применена успешно
- Все 16 юнит-тестов проходят
Зависимости:
- Добавлен django-fsm==3.0.1 в requirements.txt
144 lines
2.7 KiB
Plaintext
144 lines
2.7 KiB
Plaintext
aiofiles==24.1.0
|
|
aiogram==3.21.0
|
|
aiohappyeyeballs==2.6.1
|
|
aiohttp==3.12.15
|
|
aiosignal==1.4.0
|
|
amqp==5.3.1
|
|
annotated-types==0.7.0
|
|
anyio==4.12.0
|
|
APScheduler==3.11.0
|
|
asgiref==3.11.0
|
|
attrs==25.4.0
|
|
autobahn==25.12.2
|
|
Automat==25.4.16
|
|
beautifulsoup4==4.13.4
|
|
billiard==4.2.4
|
|
cbor2==5.7.1
|
|
celery==5.5.3
|
|
certifi==2025.11.12
|
|
cffi==2.0.0
|
|
channels==4.3.1
|
|
channels_redis==4.3.0
|
|
charset-normalizer==3.4.4
|
|
click==8.3.1
|
|
click-didyoumean==0.3.1
|
|
click-plugins==1.1.1.2
|
|
click-repl==0.3.0
|
|
colorama==0.4.6
|
|
cron-descriptor==2.0.6
|
|
confusable-homoglyphs==3.3.1
|
|
constantly==23.10.4
|
|
cryptography==45.0.6
|
|
daphne==4.2.1
|
|
defusedxml==0.7.1
|
|
dj-database-url==3.0.1
|
|
Django==5.2.4
|
|
django-allauth==65.10.0
|
|
django-bootstrap5==25.1
|
|
django-extensions==4.1
|
|
django-filter==25.1
|
|
django-phonenumber-field==8.1.0
|
|
django-registration==5.2.1
|
|
django-scheduler==0.12.0
|
|
django-service-objects==0.7.1
|
|
django-simple-history==3.10.1
|
|
django-timezone-field==7.2.1
|
|
django-watson==1.6.3
|
|
django-widget-tweaks==1.5.0
|
|
djangorestframework==3.16.0
|
|
djangorestframework_simplejwt==5.5.1
|
|
djoser==2.3.3
|
|
et_xmlfile==2.0.0
|
|
frozenlist==1.8.0
|
|
gunicorn==23.0.0
|
|
h11==0.16.0
|
|
http_ece==1.2.1
|
|
httpcore==1.0.9
|
|
httpx==0.28.1
|
|
humanize==4.15.0
|
|
hyperlink==21.0.0
|
|
icalendar==7.0.1
|
|
idna==3.11
|
|
Incremental==24.11.0
|
|
iniconfig==2.3.0
|
|
kombu==5.5.4
|
|
ldap3==2.9.1
|
|
magic-filter==1.0.12
|
|
model-bakery==1.20.5
|
|
msgpack==1.1.2
|
|
multidict==6.7.0
|
|
oauthlib==3.3.1
|
|
openpyxl==3.1.5
|
|
packaging==25.0
|
|
phonenumbers==9.0.10
|
|
pillow==11.3.0
|
|
pluggy==1.6.0
|
|
prometheus_client==0.23.1
|
|
prompt_toolkit==3.0.52
|
|
propcache==0.4.1
|
|
psycopg2-binary==2.9.10
|
|
py-ubjson==0.16.1
|
|
py-vapid==1.9.2
|
|
pyasn1==0.6.1
|
|
pyasn1_modules==0.4.2
|
|
pycparser==2.23
|
|
pycryptodome==3.23.0
|
|
pydantic==2.11.10
|
|
pydantic_core==2.33.2
|
|
Pygments==2.19.2
|
|
PyJWT==2.10.1
|
|
pyOpenSSL==25.1.0
|
|
pytest==8.4.1
|
|
pytest-asyncio==1.3.0
|
|
pytest-django==4.11.1
|
|
python-crontab==3.3.0
|
|
python-dateutil==2.9.0.post0
|
|
python-dotenv==1.1.1
|
|
python-telegram-bot==22.3
|
|
python3-openid==3.2.0
|
|
pytz==2025.2
|
|
pywebpush==2.1.2
|
|
qrcode==8.1
|
|
redis==6.4.0
|
|
requests==2.32.4
|
|
requests-oauthlib==2.0.0
|
|
rules==3.5
|
|
service-identity==24.2.0
|
|
six==1.17.0
|
|
social-auth-app-django==5.5.1
|
|
social-auth-core==4.7.0
|
|
soupsieve==2.8.1
|
|
sqlparse==0.5.5
|
|
tornado==6.5.4
|
|
Twisted==25.5.0
|
|
txaio==25.12.2
|
|
typing-inspection==0.4.2
|
|
typing_extensions==4.15.0
|
|
tzdata==2025.3
|
|
tzlocal==5.3.1
|
|
ujson==5.11.0
|
|
urllib3==2.6.2
|
|
vine==5.1.0
|
|
wcwidth==0.2.14
|
|
yarl==1.22.0
|
|
zope.interface==8.1.1
|
|
|
|
# Celery и связанные пакеты (redis уже есть выше)
|
|
django-celery-beat>=2.7.0
|
|
django-celery-results>=2.5.1
|
|
flower>=2.0.1
|
|
|
|
# Push Notifications
|
|
django-push-notifications==3.1.0
|
|
|
|
# File Management with django-filer
|
|
django-filer==3.4.4
|
|
easy-thumbnails==2.10.1
|
|
django-mptt==0.18.0 # Dependency for filer
|
|
|
|
# Version Control for Models
|
|
django-reversion==6.1.0
|
|
|
|
# Workflow State Machine
|
|
django-fsm==3.0.1
|