def submit_logs_view(request): collection_list = SubmitLog.objects.all().order_by("-created_at") collection_list = paginate(collection_list, per_page=25, page=request.GET.get("page")) return render(request, "web/content/submit_logs.html", dict(collection_list=collection_list))
def get(self, request, *args, **kwargs): products = Product.objects.filter(user=request.user, is_deleted = False) search = request.GET.get("search" , None) branch = request.GET.get("branch", None) template = request.GET.get("template",None) status = request.GET.get("status", None) if search: query_entry = get_query(search, ("branch__name", "template__name",)) products = products.filter(query_entry) if template: query_entry = get_query(template, ("template__name",)) products = products.filter(query_entry) if branch: query_entry = get_query(branch, ("branch__name",)) products = products.filter(query_entry) if status: query_entry = get_query(status, ("status",)) products = products.filter(query_entry) products = paginate(objects=products, per_page=5, page = request.GET.get("page")) self.ctx = { 'products' : products, 'branch' : Branch.objects.filter(user=request.user,is_deleted = False), 'template' : ProductTemplate.objects.filter(user=request.user, is_deleted = False), 'status' : Product.STATUSES, } return render(request, self.template_name, self.ctx)
def get_context_data(self, **kwargs): context = super(ProfileView, self).get_context_data(**kwargs) products = self.get_queryset() products = paginate( objects=products, per_page=6, page=self.request.GET.get("page")) context['products'] = products return context
def activity_log_view(request): activitylogs = ActivityLog.objects.filter(user=request.user) search = request.GET.get("search") if search: entry_query = get_query(search, ( "ip", "path", )) activitylogs = activitylogs.filter(entry_query) activitylogs = paginate(objects=activitylogs, per_page=24, page=request.GET.get("page")) return render(request, "auth/activity_log.html", dict(activitylogs=activitylogs))
def notify_list(request): collectionlist = Notification.objects.filter( user=request.user).order_by("-created") q = request.GET.get("q") if q: entry_query = get_query(q, ( "title", "body", )) collectionlist = collectionlist.filter(entry_query) collectionlist = paginate(collectionlist, per_page=PER_PAGE, page=request.GET.get("page", 1)) template_name = 'web/notify-list.html' return render(request, template_name, dict(collectionlist=collectionlist))
def get(self, request, *args, **kwargs): tickets = Ticket.objects.filter(user=request.user) title = request.GET.get("title", None) ticket_type = request.GET.get("ticket_type", None) ticket_status = request.GET.get("ticket_status", None) ticket_priority = request.GET.get("ticket_priority", None) tickets = paginate(objects=tickets, per_page=12, page=request.GET.get("page")) self.ctx = { 'statuses': Ticket.STATUSES, 'types': Ticket.TYPES, 'priorities': Ticket.PRIORITIES, 'tickets': tickets } return render(request, self.template_name, self.ctx)