TestingView post
This commit is contained in:
1 parent
b41bc76176
commit
8163de2c3a
1 file changed
+13
-9
+13
-9
@@ -272,15 +272,19 @@ class TestingView(generics.ListCreateAPIView):
|
|||||||
def post(self, request):
|
def post(self, request):
|
||||||
"""create testing"""
|
"""create testing"""
|
||||||
try:
|
try:
|
||||||
testing = Testing.objects.create(
|
dictemployees = DictEmployee.objects.filter(id__in=request.data["user_id"])
|
||||||
user=User.objects.get(user=DictEmployee.objects.get(id=request.data["user_id"])),
|
users = User.objects.filter(user__in=dictemployees).distinct()
|
||||||
test=Test.objects.get(id=request.data["test_id"]),
|
test = Test.objects.get(id=request.data["test_id"])
|
||||||
datestart=request.data["datestart"],
|
for user in users:
|
||||||
completion_date=request.data["completion_date"],
|
testing = Testing.objects.create(
|
||||||
test_passed=False,
|
user=user,
|
||||||
)
|
test=test,
|
||||||
if request.data.get("news"):
|
datestart=request.data["datestart"],
|
||||||
self.create_news(request, testing)
|
completion_date=request.data["completion_date"],
|
||||||
|
test_passed=False,
|
||||||
|
)
|
||||||
|
if request.data.get("news"):
|
||||||
|
self.create_news(request, testing)
|
||||||
return Response(
|
return Response(
|
||||||
{"status": "success", "message": "Testing created successfully."},
|
{"status": "success", "message": "Testing created successfully."},
|
||||||
status=200,
|
status=200,
|
||||||
|
|||||||
Reference in new issue
Block a user