Skip to content
Snippets Groups Projects
Commit ccbd625b authored by dcz's avatar dcz
Browse files

Send about removing slowal frame info to walenty service.

parent 4627f766
Branches
No related merge requests found
......@@ -191,4 +191,6 @@ SUPER_LEXICOGRAPHS_GROUP_NAME = 'Super Leksykografowie'
DATE_INPUT_FORMATS = ['%d-%m-%Y']
UNIFIED_FRAME_SERVICE_URL = get_environment('UNIFIED_FRAME_SERVICE_URL',
default="http://127.0.0.1:8000/en/unifier/build_unified_frame_xml/?frame_id=")
default='http://127.0.0.1:8000/en/unifier/build_unified_frame_xml/?frame_id=')
SLOWAL_FRAME_REMOVE_SERVICE_URL = get_environment('SLOWAL_FRAME_REMOVE_SERVICE_URL',
default='http://walentygroupies.ipipan.waw.pl/ajax/frame_statuses_free/?unifier_frame_ids=')
......@@ -408,6 +408,11 @@ def change_slowal_frame_status(request):
frame = Frame.objects.get(pk=slowal_frame_id)
frame.status = status
frame.save()
if status == choices.FrameStatus.BAD or choices.FrameStatus.INVALID:
http = urllib3.PoolManager()
r = http.request('GET', settings.SLOWAL_FRAME_REMOVE_SERVICE_URL + str(slowal_frame_id))
return JsonResponse({})
return JsonResponse({})
......@@ -677,6 +682,13 @@ def remove_unified_frame_mappings_and_assigments(unified_frame_id):
def delete_unified_frame(request, unified_frame_id):
remove_unified_frame_mappings_and_assigments(unified_frame_id)
UnifiedFrameArgument.objects.filter(unified_frame_id=unified_frame_id).delete()
slowal_frames = UnifiedFrame2SlowalFrameMapping.objects.filter(unified_frame_id=unified_frame_id).all()
slowal_frames_ids = ','.join(list(map(lambda slowal_frame: slowal_frame.id, slowal_frames)))
http = urllib3.PoolManager()
r = http.request('GET', settings.SLOWAL_FRAME_REMOVE_SERVICE_URL + slowal_frames_ids)
UnifiedFrame.objects.get(id=unified_frame_id).delete()
return {}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment