kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
				
				
				
			Replaced is_public flag by brand new privacy_level field on playlists
							rodzic
							
								
									9fdbc7b859
								
							
						
					
					
						commit
						859f8a0570
					
				| 
						 | 
				
			
			@ -5,7 +5,7 @@ from . import models
 | 
			
		|||
 | 
			
		||||
@admin.register(models.Playlist)
 | 
			
		||||
class PlaylistAdmin(admin.ModelAdmin):
 | 
			
		||||
    list_display = ['name', 'user', 'is_public', 'creation_date']
 | 
			
		||||
    list_display = ['name', 'user', 'privacy_level', 'creation_date']
 | 
			
		||||
    search_fields = ['name', ]
 | 
			
		||||
    list_select_related = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
# Generated by Django 2.0.3 on 2018-03-16 22:17
 | 
			
		||||
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('playlists', '0001_initial'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.RemoveField(
 | 
			
		||||
            model_name='playlist',
 | 
			
		||||
            name='is_public',
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='playlist',
 | 
			
		||||
            name='privacy_level',
 | 
			
		||||
            field=models.CharField(choices=[('me', 'Only me'), ('followers', 'Me and my followers'), ('instance', 'Everyone on my instance, and my followers'), ('everyone', 'Everyone, including people on other instances')], default='instance', max_length=30),
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
| 
						 | 
				
			
			@ -3,13 +3,15 @@ from django.utils import timezone
 | 
			
		|||
 | 
			
		||||
from mptt.models import MPTTModel, TreeOneToOneField
 | 
			
		||||
 | 
			
		||||
from funkwhale_api.common import fields
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Playlist(models.Model):
 | 
			
		||||
    name = models.CharField(max_length=50)
 | 
			
		||||
    is_public = models.BooleanField(default=False)
 | 
			
		||||
    user = models.ForeignKey(
 | 
			
		||||
        'users.User', related_name="playlists", on_delete=models.CASCADE)
 | 
			
		||||
    creation_date = models.DateTimeField(default=timezone.now)
 | 
			
		||||
    privacy_level = fields.get_privacy_field()
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.name
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,5 +26,5 @@ class PlaylistSerializer(serializers.ModelSerializer):
 | 
			
		|||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        model = models.Playlist
 | 
			
		||||
        fields = ('id', 'name', 'is_public', 'creation_date', 'playlist_tracks')
 | 
			
		||||
        fields = ('id', 'name', 'privacy_level', 'creation_date', 'playlist_tracks')
 | 
			
		||||
        read_only_fields = ['id', 'playlist_tracks', 'creation_date']
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue