mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 18:52:23 +01:00
Merge both search-fields into one
This commit is contained in:
committed by
Daan Sprenkels
parent
581e14f7ef
commit
4c9a431f8a
@ -95,8 +95,7 @@ def songs(request):
|
||||
|
||||
def search_songs():
|
||||
queries = [Q(deleted=False)]
|
||||
queries.extend([Q(Q(artist__icontains=word) | Q(title__icontains=word)) for word in request.POST.get('all', '').split()])
|
||||
queries.extend([Q(user__name__icontains=word) for word in request.POST.get('uploader', '').split()])
|
||||
queries.extend([Q(Q(artist__icontains=word) | Q(title__icontains=word) | Q(user__name__icontains=word)) for word in request.POST.get('all', '').split()])
|
||||
|
||||
filter_query = queries.pop()
|
||||
for query in queries:
|
||||
|
||||
@ -310,10 +310,9 @@ function refreshSeconds(playNextAt, now) {
|
||||
|
||||
function getSongs() {
|
||||
var all = $('#search-all').val();
|
||||
var uploader = $('#search-uploader').val();
|
||||
var page = $('.pagenum').val();
|
||||
var pagesize = $('.pagesize').val();
|
||||
$.post('/api/songs', {all: all, uploader: uploader, page: page, pagesize: pagesize, csrfmiddlewaretoken: csrf_token}, function (result) {
|
||||
$.post('/api/songs', {all: all, page: page, pagesize: pagesize, csrfmiddlewaretoken: csrf_token}, function (result) {
|
||||
$('#request-table tbody').empty();
|
||||
songs = result.data;
|
||||
$.each(songs, function (id, song) {
|
||||
@ -413,4 +412,4 @@ function createAlert(type, message) {
|
||||
message +
|
||||
'</div>';
|
||||
$('body > div.container > div.alert-location').prepend(alertText);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,7 @@
|
||||
<th>Report</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"><input id="search-all" class="search-input" type="text"></th>
|
||||
<th colspan="3"><input id="search-uploader" class="search-input" type="text"></th>
|
||||
<th colspan="5"><input id="search-all" class="search-input" type="text"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
|
||||
Reference in New Issue
Block a user