summaryrefslogtreecommitdiff
path: root/ishtar_common/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r--ishtar_common/views.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 66642090f..c2b292ed4 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -1789,9 +1789,9 @@ class ImportListView(IshtarMixin, LoginRequiredMixin, ListView):
def get_queryset(self):
q = self.model.objects.exclude(state='AC')
if self.request.user.is_superuser:
- return q.order_by('-creation_date')
+ return q.order_by('-creation_date').order_by('-end_date')
user = models.IshtarUser.objects.get(pk=self.request.user.pk)
- return q.filter(user=user).order_by('-creation_date')
+ return q.filter(user=user).order_by('-end_date')
def post(self, request, *args, **kwargs):
for field in request.POST:
@@ -1824,6 +1824,26 @@ class ImportListView(IshtarMixin, LoginRequiredMixin, ListView):
return HttpResponseRedirect(reverse(self.current_url))
+class ImportListTableView(ImportListView):
+ template_name = 'ishtar/import_table.html'
+ current_url = 'current_imports_table'
+
+ def get_context_data(self, **kwargs):
+ dct = super(ImportListTableView, self).get_context_data(**kwargs)
+ dct['AJAX'] = True
+ dct['MESSAGES'] = []
+ request = self.request
+ if 'messages' in request.session and \
+ request.session['messages']:
+ for message, message_type in request.session['messages']:
+ dct['MESSAGES'].append((message, message_type))
+ request.session['messages'] = []
+ if 'current_import_id' in request.session and \
+ request.session['current_import_id']:
+ dct['refreshed_pks'] = request.session.pop('current_import_id')
+ return dct
+
+
class ImportOldListView(ImportListView):
page_name = _(u"Old imports")
current_url = 'old_imports'