Commit 936ed488 authored by fred's avatar fred

quick edit of metadata of recently added files

parent ef855a5f
......@@ -81,6 +81,8 @@ class Track(models.Model):
from emissions.models import Nonstop
for zone in Nonstop.objects.all():
if not zone.slug in TRANCHE_SLUG_DIR_MAPPING:
zone_dir = TRANCHE_SLUG_DIR_MAPPING[zone.slug]
zone_path = os.path.join(LOCAL_BASE_PATH, 'Tranches', zone_dir, filename)
if zone in current_zones:
{% extends "base.html" %}
{% load i18n %}
{% block appbar %}
<h2>Nonstop - {% trans "Recent Tracks" %}</h2>
{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
<table id="edit-recent">
<tr><th>{% trans "Title" %}</th><th>{% trans "Artist" %}</th>
<th class="en">EN</th><th class="fr">FR</th><th class="nl">NL</th>
<th class="instru">Instru</th><th class="sabam">Sabam</th><th class="cfwb">CFWB</th></tr>
{% for track in object_list %}
<td><input type="hidden" name="track" value="{{}}">{{track.title}}</td><td>{{}}</td>
<td class="en"><input type="radio" name="lang-{{}}" value="en" {% if track.language == "en" %}checked{% endif %}></td>
<td class="fr"><input type="radio" name="lang-{{}}" value="fr" {% if track.language == "fr" %}checked{% endif %}></td>
<td class="nl"><input type="radio" name="lang-{{}}" value="nl" {% if track.language == "nl" %}checked{% endif %}></td>
<td class="instru"><input type="checkbox" name="instru-{{}}" {% if track.instru %}checked{% endif %}></td>
<td class="sabam"><input type="checkbox" name="sabam-{{}}" {% if track.sabam %}checked{% endif %}></td>
<td class="cfwb"><input type="checkbox" name="cfwb-{{}}" {% if track.cfwb %}checked{% endif %}></td>
{% endfor %}
<div class="buttons">
<button class="submit-button">{% trans "Save" %}</button>
table#edit-recent th,
table#edit-recent td {
padding: 0 1ex;
$('table#edit-recent th').on('click', function() {
var propvalue = true;
if ($(this)[0].className == 'sabam') propvalue = false;
$('tbody').find('.' + $(this)[0].className + ' input').prop('checked', propvalue);
{% endblock %}
from django.conf.urls import url
from .views import SomaDayArchiveView, SomaDayArchiveCsvView, RedirectTodayView, TrackDetailView, ArtistDetailView, ArtistListView, StatisticsView, UploadTracksView
from .views import SomaDayArchiveView, SomaDayArchiveCsvView, RedirectTodayView, TrackDetailView, ArtistDetailView, ArtistListView, StatisticsView, UploadTracksView, RecentTracksView
urlpatterns = [
# Example: /2012/nov/10/
......@@ -17,4 +17,5 @@ urlpatterns = [
url(r'^upload/$', UploadTracksView.as_view(), name='nonstop-upload-tracks'),
url(r'^recent/$', RecentTracksView.as_view(), name='nonstop-recent-tracks'),
......@@ -209,9 +209,27 @@ class UploadTracksView(FormView):
track, created = Track.objects.get_or_create(title=track_title, artist=artist)
nonstop_file.track = track
if request.POST.get('nonstop_zone'):
Nonstop.objects.get(id=request.POST.get('nonstop_zone'))), '%d new track(s)' % len(tracks))
return self.form_valid(form)
class RecentTracksView(ListView):
template_name = 'nonstop/recent_tracks.html'
def get_queryset(self):
return Track.objects.all().order_by('-creation_timestamp')[:20]
def post(self, request, *args, **kwargs):
for track_id in request.POST.getlist('track'):
track = Track.objects.get(id=track_id)
track.language = request.POST.get('lang-%s' % track_id, '')
track.instru = 'instru-%s' % track_id in request.POST
track.sabam = 'sabam-%s' % track_id in request.POST
track.cfwb = 'cfwb-%s' % track_id in request.POST
return HttpResponseRedirect('.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment