Commit 943e95eda689321e4ec8594b3d5f5651ea2878d8
1 parent
905d7119
Exists in
master
and in
39 other branches
Removing data-format and unnecessary logic on forms
Showing
2 changed files
with
6 additions
and
11 deletions
Show diff stats
src/search/forms.py
@@ -98,15 +98,10 @@ class ColabSearchForm(SearchForm): | @@ -98,15 +98,10 @@ class ColabSearchForm(SearchForm): | ||
98 | if self.cleaned_data['list']: | 98 | if self.cleaned_data['list']: |
99 | sqs = sqs.filter(tag__in=self.cleaned_data['list']) | 99 | sqs = sqs.filter(tag__in=self.cleaned_data['list']) |
100 | 100 | ||
101 | - since = self.cleaned_data['since'] | ||
102 | - until = self.cleaned_data['until'] | ||
103 | - | ||
104 | - if since and until: | ||
105 | - sqs = sqs.filter(modified__gte=since, modified__lte=until) | ||
106 | - elif since and not until: | ||
107 | - sqs = sqs.filter(modified__gte=since) | ||
108 | - elif until and not since: | ||
109 | - sqs = sqs.filter(modified__lte=until) | 101 | + if self.cleaned_data['since']: |
102 | + sqs = sqs.filter(modified__gte=self.cleaned_data['since']) | ||
103 | + if self.cleaned_data['until']: | ||
104 | + sqs = sqs.filter(modified__lte=self.cleaned_data['until']) | ||
110 | 105 | ||
111 | if self.load_all: | 106 | if self.load_all: |
112 | sqs = sqs.load_all() | 107 | sqs = sqs.load_all() |
src/templates/search/search.html
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | <div class="form-group"> | 120 | <div class="form-group"> |
121 | <label for="since">{% trans "Since" %}</label> | 121 | <label for="since">{% trans "Since" %}</label> |
122 | <div class="input-group date" id="datepicker_since"> | 122 | <div class="input-group date" id="datepicker_since"> |
123 | - <input type="text" class="form-control" placeholder="{% trans "Since" %}" name="since" value="{{ request.GET.since }}" data-format="MM/dd/yyyy" /> | 123 | + <input type="text" class="form-control" placeholder="{% trans "Since" %}" name="since" value="{{ request.GET.since }}" /> |
124 | <span class="input-group-addon"> | 124 | <span class="input-group-addon"> |
125 | <span class="glyphicon glyphicon-calendar"></span> | 125 | <span class="glyphicon glyphicon-calendar"></span> |
126 | </span> | 126 | </span> |
@@ -129,7 +129,7 @@ | @@ -129,7 +129,7 @@ | ||
129 | <div class="form-group"> | 129 | <div class="form-group"> |
130 | <label for="until">{% trans "Until" %}</label> | 130 | <label for="until">{% trans "Until" %}</label> |
131 | <div class="input-group date" id="datepicker_until"> | 131 | <div class="input-group date" id="datepicker_until"> |
132 | - <input type="text" class="form-control" placeholder="{% trans "Until" %}" name="until" value="{{ request.GET.until }}" data-format="MM/dd/yyyy" /> | 132 | + <input type="text" class="form-control" placeholder="{% trans "Until" %}" name="until" value="{{ request.GET.until }}" /> |
133 | <span class="input-group-addon"> | 133 | <span class="input-group-addon"> |
134 | <span class="glyphicon glyphicon-calendar"></span> | 134 | <span class="glyphicon glyphicon-calendar"></span> |
135 | </span> | 135 | </span> |