-
Notifications
You must be signed in to change notification settings - Fork 14
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 #4053 from mikhailprivalov/allowed-forms-files-for…
…-org Прикрепление PDF к результату
- Loading branch information
Showing
9 changed files
with
92 additions
and
12 deletions.
There are no files selected for viewing
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,21 @@ | ||
from directions.models import Issledovaniya, IssledovaniyaFiles | ||
|
||
|
||
def form_01(request_data): | ||
file = request_data.get("file") | ||
user = request_data.get('user') | ||
issledovanie_id = request_data.get("entity_id") | ||
issledovanie: Issledovaniya = Issledovaniya.objects.filter(pk=issledovanie_id).select_related('research').first() | ||
if issledovanie: | ||
iss_files = IssledovaniyaFiles.objects.filter(issledovaniye_id=issledovanie.pk) | ||
if file and iss_files.count() >= 5: | ||
return {"ok": False, "result": [], "message": "Вы добавили слишком много файлов в одну заявку"} | ||
|
||
if file and file.size > 5242880: | ||
return {"ok": False, "result": [], "message": "Файл слишком большой"} | ||
|
||
iss = IssledovaniyaFiles(issledovaniye_id=issledovanie.pk, uploaded_file=file, who_add_files=user.doctorprofile) | ||
iss.save() | ||
else: | ||
return {"ok": False, "result": [], "message": "Нет такого исследования"} | ||
return {"ok": True, "result": [], "message": ""} |
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
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
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
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
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
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
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
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