diff --git a/scipost/static/scipost/assets/js/scripts.js b/scipost/static/scipost/assets/js/scripts.js index b3c0ab7cefa52a90d62b01eff3a8e20de8cd0f82..001f02c0ead487734d86757d0d303035c10f7343 100644 --- a/scipost/static/scipost/assets/js/scripts.js +++ b/scipost/static/scipost/assets/js/scripts.js @@ -2,7 +2,6 @@ function hide_all_alerts() { $(".alert").fadeOut(300); } - $(function(){ // Remove all alerts in screen automatically after 10sec. setTimeout(function() {hide_all_alerts()}, 10000); diff --git a/scipost/templates/scipost/base.html b/scipost/templates/scipost/base.html index 4a3105f7a1ef8dc2fa23b523e0415cbd2438dd72..baa04274b5b7b487f2e81c493db95e203016819d 100644 --- a/scipost/templates/scipost/base.html +++ b/scipost/templates/scipost/base.html @@ -18,6 +18,8 @@ <title>SciPost{% block pagetitle %}{% endblock pagetitle %}</title> <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> + <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> + <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> {% block headsup %} {% endblock headsup %} diff --git a/theses/forms.py b/theses/forms.py index 3f5dfcc0e5784131d4e8a0d9f7039bad5b07064a..6f8a0e2c1757dec0992cec6e55417a3aad15a17c 100644 --- a/theses/forms.py +++ b/theses/forms.py @@ -108,3 +108,5 @@ class ThesisLinkSearchForm(forms.Form): title_keyword = forms.CharField(max_length=100, label="Title", required=False) abstract_keyword = forms.CharField(max_length=1000, required=False, label="Abstract") supervisor = forms.CharField(max_length=100, required=False, label="Supervisor") + from_date = forms.DateField(widget=forms.DateInput(attrs={'type': 'date'}), required=False) + to_date = forms.DateField(widget=forms.DateInput(attrs={'type': 'date'}), required=False) diff --git a/theses/managers.py b/theses/managers.py index 68dc44574b8722927314cc063cbd22ef26c02a58..ecd55472d300655f05c42f7c0fda4b4415b4a79b 100644 --- a/theses/managers.py +++ b/theses/managers.py @@ -1,13 +1,20 @@ +import datetime + from django.db import models +from django.utils import timezone class ThesisLinkManager(models.Manager): def search_results(self, form): + from_date = form.cleaned_data['from_date'] if form.cleaned_data['from_date'] else datetime.date(1600, 1, 1) + to_date = form.cleaned_data['to_date'] if form.cleaned_data['to_date'] else timezone.now() + return self.vetted().filter( title__icontains=form.cleaned_data['title_keyword'], author__icontains=form.cleaned_data['author'], abstract__icontains=form.cleaned_data['abstract_keyword'], supervisor__icontains=form.cleaned_data['supervisor'], + defense_date__range=(from_date, to_date) ).order_by('-defense_date') def latest(self, n):