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

Sorting the unified frame list bugfix.

parent 59413cb0
No related branches found
No related tags found
No related merge requests found
......@@ -213,13 +213,32 @@ def get_unified_frames(request):
exclude_status = request.GET.get('exclude_status')
restrict_to_user = request.GET.get('restrict_to_user')
scroller_params = get_scroller_params(request.POST)
first_index, last_index = scroller_params['start'], scroller_params['start'] + scroller_params['length']
order_field, order_dir = scroller_params['order']
if order_field == 0:
order_field = 'title'
elif order_field == 1:
order_field = 'status'
else:
order_field = None
if order_dir == 'desc' and order_field is not None:
order_field = '-' + order_field
errors_dict = dict()
if 'unified_frame_form' in request.session:
forms = collect_forms(request.session['unified_frame_form'], errors_dict)
unified_frames = get_filtered_objects(forms).filter()
else:
unified_frames = UnifiedFrame.objects.order_by('title').all()
unified_frames = UnifiedFrame.objects
if order_field is not None:
unified_frames = unified_frames.order_by(order_field)
unified_frames = unified_frames.all()
if scroller_params['filter']:
unified_frames = unified_frames.filter(title__startswith=scroller_params['filter'])
......@@ -254,6 +273,8 @@ def get_unified_frames(request):
value['status'] == choices.UnifiedFrameStatus.VERIFIED:
res_processed.append(value)
res_processed = res_processed[first_index:last_index]
ret = {
'draw': scroller_params['draw'],
'recordsTotal': len(res_processed),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment