playlist privées
This commit is contained in:
parent
22af46bbf1
commit
01ec7be090
5 changed files with 27 additions and 5 deletions
|
@ -8,7 +8,7 @@ from player.models import Playlist, Link
|
|||
class PlaylistForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Playlist
|
||||
fields = ['name']
|
||||
fields = ['name', 'public']
|
||||
|
||||
def is_valid(self):
|
||||
self.instance.date = timezone.now()
|
||||
|
|
18
player/migrations/0004_playlist_public.py
Normal file
18
player/migrations/0004_playlist_public.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.0.3 on 2018-03-28 17:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('player', '0003_auto_20180328_1612'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='playlist',
|
||||
name='public',
|
||||
field=models.BooleanField(default=True, verbose_name="Visible sur la page d'accueil"),
|
||||
),
|
||||
]
|
|
@ -15,6 +15,10 @@ class Playlist(models.Model):
|
|||
last_get = models.DateTimeField(
|
||||
verbose_name="Dernière écoute"
|
||||
)
|
||||
public = models.BooleanField(
|
||||
verbose_name="Visible sur la page d'accueil",
|
||||
default=True,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def reverse_token(token):
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
</script>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-6">
|
||||
<h1>{{playlist.name}}</h1>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<a class="btn btn-success btn-sm" type='button' href="">
|
||||
<a class="btn btn-outline-success btn-sm" type='button' href="">
|
||||
<i class="fa fa-edit"></i> Changer le nom
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-3">
|
||||
Lien de partage : <input class="input-monospace" value="{{request.get_host}}{{playlist.get_absolute_url}}" type="text" readonly="">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -72,5 +72,5 @@ def playlist(request, token):
|
|||
|
||||
|
||||
def all_playlist(request):
|
||||
p = Playlist.objects.all().order_by('date')
|
||||
p = Playlist.objects.filter(public=True).order_by('date')
|
||||
return render(request, 'player/all_list.html', {'lists':p})
|
||||
|
|
Loading…
Reference in a new issue