]> git.0d.be Git - django-panik-nonstop.git/commitdiff
add links to nonstop home, and handle permissions
authorFrédéric Péters <fpeters@0d.be>
Thu, 5 Oct 2017 16:39:36 +0000 (18:39 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 5 Oct 2017 16:40:26 +0000 (18:40 +0200)
nonstop/templates/nonstop/artist_detail.html
nonstop/templates/nonstop/artist_list.html
nonstop/templates/nonstop/cleanup.html
nonstop/templates/nonstop/quick_links.html
nonstop/templates/nonstop/recent_tracks.html
nonstop/templates/nonstop/search.html
nonstop/templates/nonstop/somalogline_archive_day.html
nonstop/templates/nonstop/statistics.html
nonstop/templates/nonstop/track_detail.html
nonstop/templates/nonstop/upload.html
nonstop/views.py

index 7fadf46caab17180b675f6820e54a5b65473a7d9..1b542d28ca5a65b1c875f4db960a4898b5eaba94 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop - Artist: {{ object.name }}</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 
 <h3>{% trans "Most recently played" %}</h3>
index 4ab8548a6ab2ea9132cbe8a9e5f53712d7135c9a..05fc43a00b78e815ee4e69ee4690a0e8c1d6fd5e 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop - Artists</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 
 <ul class="artists-list">
index f66704d456fd312420f834d7a4a88c446f08d91c..8d155a52525d4dbdf6053fdfd2dd9a0dcdc28fd1 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop{% if zone %} — {{zone.title}} — {{count}} tracks{% endif %}</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 <form id="track-search">
   {{ form.as_p }}
index 995bee6aabb6a8691b7f87c57c63bcc42ce15c7e..df15ddae2c078e7f9893b41c4faafc3ac178b161 100644 (file)
@@ -5,14 +5,21 @@
 <h2>Nonstop</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 
 <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>
+{% if perms.nonstop.add_track %}
  <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>
  <li><a href="{% url 'nonstop-cleanup' %}">Nettoyage de vieux morceaux</a></li>
+{% endif %}
 </ul>
 {% endblock %}
index 171a451799a77607fe390cf20f9f692fa1ba4e3a..87dec1497749afe2bfc417161a9baed229aa6bae 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop - {% trans "Recent Tracks" %}</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 <form method="post">
 {% csrf_token %}
index 02ec94ce1e6a2f9c67da83a69ed9871484d03ad7..72d1163d737ca61e5e5e8fde81d9bb61aff1f390 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 <form id="track-search">
   {{ form.as_p }}
index 6c9c2dc1dce26b0a53075222908ff778c2fbc61f..98baf79e01d5d4aabe6772db6ba3468616439e71 100644 (file)
@@ -8,7 +8,8 @@
 {% endblock %}
 
 {% block more-user-links %}
-<a href="{% url 'nonstop-today' %}">Aujourd'hui</a>
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
 {% endblock %}
 
 {% block content %}
index f5e50b08598811072a4452ec634984843e0c8cbe..302fb63d04ccc12eca402f51b912a1a899d235af 100644 (file)
@@ -7,6 +7,11 @@
 <a href="?from=-30d">during last month</a>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 
 <div class="nonstop-stats">
index 3cd47ea211f0dc1865625569f9a44741a77fba61..a382ca82eca7ff88e5914dded0e63548e232716c 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop - Track: {{ object.artist.name }} / {{ object.title }}</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 
 {% if not object.file_exists %}
@@ -31,6 +36,7 @@
 
 <p>In nonstop since {{ object.added_to_nonstop_timestamp|date:"SHORT_DATE_FORMAT" }}.</p>
 
+{% if perms.nonstop.add_track %}
 <form method="POST">
   {% csrf_token %}
   {{ metadata_form.as_p }}
@@ -41,6 +47,8 @@
 </div>
 {% endif %}
 
+{% endif %}
+
 <style>
 ul.soma-list {
   float: left;
index 11722445c9bcc62a03bf0eafdfbc7ba837c03d30..5cbe5eb1689fd31f955bb433d1dbc7f85ae6fd8c 100644 (file)
@@ -5,6 +5,11 @@
 <h2>Nonstop - {% trans "Upload" %}</h2>
 {% endblock %}
 
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
+{% endblock %}
+
 {% block content %}
 
 <form method="post" enctype="multipart/form-data">
@@ -14,7 +19,7 @@
   {{ form.as_p }}
   <div class="buttons">
     <button class="submit-button">{% trans "Upload" %}</button>
-    <a class="cancel" href="...">{% trans "Cancel" %}</a>
+    <a class="cancel" href="{% url 'nonstop-quick-links' %}">{% trans "Cancel" %}</a>
   </div>
 </form>
 
index 5c1bf3c33e16c06f795e9fb9bcc6f7d7a8bbbe52..376f33bd6b94d8c7af0097c3e8a39a39b75af83e 100644 (file)
@@ -69,6 +69,7 @@ class TrackDetailView(DetailView):
         return ctx
 
     def post(self, request, *args, **kwargs):
+        assert self.request.user.has_perm('nonstop.add_tracks')
         instance = self.get_object()
         old_nonstop_zones = copy.copy(instance.nonstop_zones.all())
         form = TrackMetaForm(request.POST, instance=instance)
@@ -171,6 +172,7 @@ class UploadTracksView(FormView):
     success_url = '.'
 
     def post(self, request, *args, **kwargs):
+        assert self.request.user.has_perm('nonstop.add_tracks')
         form_class = self.get_form_class()
         form = self.get_form(form_class)
         tracks = request.FILES.getlist('tracks')
@@ -228,6 +230,7 @@ class RecentTracksView(ListView):
         return Track.objects.exclude(creation_timestamp__isnull=True).order_by('-creation_timestamp')[:50]
 
     def post(self, request, *args, **kwargs):
+        assert self.request.user.has_perm('nonstop.add_tracks')
         for track_id in request.POST.getlist('track'):
             track = Track.objects.get(id=track_id)
             track.language = request.POST.get('lang-%s' % track_id, '')
@@ -302,6 +305,7 @@ class CleanupView(TemplateView):
         return ctx
 
     def post(self, request, *args, **kwargs):
+        assert self.request.user.has_perm('nonstop.add_tracks')
         count = 0
         for track_id in request.POST.getlist('track'):
             if request.POST.get('remove-%s' % track_id):