Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
django-panik-nonstop
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
radiopanik
django-panik-nonstop
Commits
d366e423
Commit
d366e423
authored
Oct 03, 2017
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add search page
parent
a83ed11d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
1 deletion
+46
-1
nonstop/templates/nonstop/quick_links.html
nonstop/templates/nonstop/quick_links.html
+1
-0
nonstop/templates/nonstop/search.html
nonstop/templates/nonstop/search.html
+31
-0
nonstop/urls.py
nonstop/urls.py
+2
-1
nonstop/views.py
nonstop/views.py
+12
-0
No files found.
nonstop/templates/nonstop/quick_links.html
View file @
d366e423
...
...
@@ -10,6 +10,7 @@
<ul>
<li><a
href=
"{% url 'nonstop-today' %}"
>
Aujourd'hui
</a>
(avec des liens pour naviguer vers les autres jours)
</li>
<li><a
href=
"{% url 'artist-list' %}"
>
Artistes
</a>
présents (un jour ou l'autre) dans le nonstop
</li>
<li><a
href=
"{% url 'nonstop-search' %}"
>
Recherche
</a>
dans les pistes et artistes
</li>
<li><a
href=
"{% url 'nonstop-upload-tracks' %}"
>
Ajout de nouveaux morceaux
</a></li>
<li><a
href=
"{% url 'nonstop-recent-tracks' %}"
>
Édition rapide de métadonnées de nouveaux morceaux
</a>
(langue, Instru, SABAM, CFWB)
</li>
</ul>
...
...
nonstop/templates/nonstop/search.html
0 → 100644
View file @
d366e423
{% extends "base.html" %}
{% load i18n %}
{% block appbar %}
<h2>
Nonstop
</h2>
{% endblock %}
{% block content %}
<form><input
name=
"q"
type=
"search"
><button>
{% trans "Search" %}
</button></form>
<hr>
{% if artists.exists %}
<h3>
{% trans "Artists" %}
</h3>
<ul>
{% for artist in artists %}
<li><a
href=
"{% url 'artist-view' pk=artist.id %}"
>
{{artist.name}}
</a></li>
{% endfor %}
</ul>
{% endif %}
{% if tracks.exists %}
<h3>
{% trans "Tracks" %}
</h3>
<ul>
{% for track in tracks %}
<li><a
href=
"{% url 'track-view' pk=track.id %}"
>
{{track.title}}
</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
nonstop/urls.py
View file @
d366e423
from
django.conf.urls
import
url
from
.views
import
SomaDayArchiveView
,
SomaDayArchiveCsvView
,
RedirectTodayView
,
TrackDetailView
,
ArtistDetailView
,
ArtistListView
,
StatisticsView
,
UploadTracksView
,
RecentTracksView
,
QuickLinksView
from
.views
import
SomaDayArchiveView
,
SomaDayArchiveCsvView
,
RedirectTodayView
,
TrackDetailView
,
ArtistDetailView
,
ArtistListView
,
StatisticsView
,
UploadTracksView
,
RecentTracksView
,
QuickLinksView
,
SearchView
urlpatterns
=
[
# Example: /2012/nov/10/
...
...
@@ -18,5 +18,6 @@ urlpatterns = [
url
(
r'^upload/$'
,
UploadTracksView
.
as_view
(),
name
=
'nonstop-upload-tracks'
),
url
(
r'^recent/$'
,
RecentTracksView
.
as_view
(),
name
=
'nonstop-recent-tracks'
),
url
(
r'^search/$'
,
SearchView
.
as_view
(),
name
=
'nonstop-search'
),
url
(
r'^quick-links/$'
,
QuickLinksView
.
as_view
(),
name
=
'nonstop-quick-links'
),
]
nonstop/views.py
View file @
d366e423
...
...
@@ -238,3 +238,15 @@ class RecentTracksView(ListView):
class
QuickLinksView
(
TemplateView
):
template_name
=
'nonstop/quick_links.html'
class
SearchView
(
TemplateView
):
template_name
=
'nonstop/search.html'
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
SearchView
,
self
).
get_context_data
(
**
kwargs
)
q
=
self
.
request
.
GET
.
get
(
'q'
)
if
q
:
ctx
[
'artists'
]
=
Artist
.
objects
.
filter
(
name__icontains
=
q
.
lower
())
ctx
[
'tracks'
]
=
Track
.
objects
.
filter
(
title__icontains
=
q
.
lower
())
return
ctx
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment