mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
@@ -224,6 +224,7 @@ class EventArchive(generic.ListView):
|
||||
|
||||
context['start'] = self.request.GET.get('start', None)
|
||||
context['end'] = self.request.GET.get('end', datetime.date.today().strftime('%Y-%m-%d'))
|
||||
context['statuses'] = models.Event.EVENT_STATUS_CHOICES
|
||||
return context
|
||||
|
||||
def get_queryset(self):
|
||||
@@ -263,6 +264,11 @@ class EventArchive(generic.ListView):
|
||||
|
||||
filter &= qfilter
|
||||
|
||||
status = self.request.GET.getlist('status', "")
|
||||
|
||||
if len(status) > 0:
|
||||
filter &= Q(status__in=status)
|
||||
|
||||
qs = self.model.objects.filter(filter).order_by('-start_date')
|
||||
|
||||
# Preselect related for efficiency
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,11 +8,14 @@
|
||||
color: $gray-100;
|
||||
border: black !important;
|
||||
}
|
||||
.btn-light {
|
||||
.btn-light, .popover-header {
|
||||
background: #121416 !important;
|
||||
color: $gray-100 !important;
|
||||
border: black !important;
|
||||
}
|
||||
a {
|
||||
color: $blue;
|
||||
}
|
||||
}
|
||||
@import "custom-variables";
|
||||
@import "node_modules/bootstrap/scss/bootstrap";
|
||||
|
||||
@@ -1,26 +1,36 @@
|
||||
{% extends 'base_rigs.html' %}
|
||||
{% load paginator from filters %}
|
||||
{% load get_list from filters %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Event Archive{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap-select.css' %}"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block preload_js %}
|
||||
<script src="{% static 'js/bootstrap-select.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h2>Event Archive</h2>
|
||||
</div>
|
||||
<div class="col-sm-12 py-2">
|
||||
<form class="form-inline">
|
||||
<form class="form-inline" method="GET">
|
||||
<div class="input-group mx-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Start</span>
|
||||
</div>
|
||||
<input type="date" name="start" id="start" value="{{ start|default_if_none:"" }}" placeholder="Start" class="form-control" />
|
||||
<input type="date" name="start" id="start" value="{{ start|default_if_none:'' }}" placeholder="Start" class="form-control" />
|
||||
</div>
|
||||
<div class="input-group mx-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">End</span>
|
||||
</div>
|
||||
<input type="date" name="end" id="end" value="{{ end|default_if_none:"" }}" placeholder="End" class="form-control" />
|
||||
<input type="date" name="end" id="end" value="{{ end|default_if_none:'' }}" placeholder="End" class="form-control" />
|
||||
</div>
|
||||
<div class="input-group mx-2">
|
||||
<div class="input-group-prepend">
|
||||
@@ -28,6 +38,11 @@
|
||||
</div>
|
||||
<input type="search" name="q" placeholder="Keyword" value="{{ request.GET.q }}" class="form-control" />
|
||||
</div>
|
||||
<select class="selectpicker pr-3" multiple data-actions-box="true" data-none-selected-text="Status" data-actions-box="true" id="status" name="status">
|
||||
{% for status in statuses %}
|
||||
<option value="{{status.0}}" {% if status.0|safe in request.GET|get_list:'status' %}selected=""{% endif %}>{{status.1}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="submit" class="btn btn-primary" value="Search"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -121,3 +121,8 @@ def help_text(obj, field):
|
||||
@register.filter
|
||||
def verbose_name(obj, field):
|
||||
return obj._meta.get_field(field).verbose_name
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_list(dictionary, key):
|
||||
return dictionary.getlist(key)
|
||||
|
||||
Reference in New Issue
Block a user