Commit 8f237aae authored by Ilya Simonov's avatar Ilya Simonov

add fields for playlist

parent 47a56d37
......@@ -35,8 +35,13 @@ class VideoAdmin(admin.ModelAdmin):
class PlayListAdmin(admin.ModelAdmin):
list_display = ['id', 'title', ]
list_display = ['id', 'title', 'type']
readonly_fields = ['created', 'updated']
list_filter = ('type', 'sort')
inlines = [TagInline]
def get_inlines(self, request, obj):
return self.inlines if obj.type == models.DYNAMIC else []
class CategoryAdmin(admin.ModelAdmin):
......
# Generated by Django 4.1.7 on 2023-03-06 16:31
# Generated by Django 4.1.7 on 2023-03-06 16:52
import apps.core.utils
from django.conf import settings
......@@ -116,6 +116,10 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='created')),
('title', models.CharField(max_length=255, verbose_name='title')),
('description', models.TextField(blank=True, null=True, verbose_name='description')),
('sort', models.CharField(blank=True, choices=[('last_updated', 'Last updated'), ('most_recently_published', 'Most recently published'), ('title_a_z', 'Title A-Z'), ('title_z_a', 'Title Z-A'), ('shorter_first', 'Shorter first'), ('longer_first', 'Longer first')], max_length=255)),
('type', models.CharField(blank=True, choices=[('dynamic', 'Dynamic'), ('freestyle', 'Freestyle')], max_length=255)),
('mrss', models.CharField(blank=True, max_length=255, null=True, verbose_name='mrss')),
('json', models.CharField(blank=True, max_length=255, null=True, verbose_name='json')),
('videos', models.ManyToManyField(related_name='playlist', to='core.video')),
],
options={
......
......@@ -20,6 +20,28 @@ STATUS_CHOICES = (
(FAIL, 'Fail'),
)
DYNAMIC = 'dynamic'
FREESTYLE = 'freestyle'
TYPE_CHOICES = (
(DYNAMIC, 'Dynamic'),
(FREESTYLE, 'Freestyle'),
)
LAST_UPDATED = 'last_updated'
MOST_RECENTLY_PUBLISHED = 'most_recently_published'
TITLE_A_Z = 'title_a_z'
TITLE_Z_A = 'title_z_a'
SHORTER_FIRST = 'shorter_first'
LONGER_FIRST = 'longer_first'
SORT_CHOICES = (
(LAST_UPDATED, 'Last updated'),
(MOST_RECENTLY_PUBLISHED, 'Most recently published'),
(TITLE_A_Z, 'Title A-Z'),
(TITLE_Z_A, 'Title Z-A'),
(SHORTER_FIRST, 'Shorter first'),
(LONGER_FIRST, 'Longer first'),
)
class BaseModel(models.Model):
updated = models.DateTimeField(_('updated'), auto_now=True, db_index=True)
......@@ -144,6 +166,10 @@ class Playlist(BaseModel):
title = models.CharField(_('title'), max_length=255)
description = models.TextField(_('description'), blank=True, null=True)
videos = models.ManyToManyField(Video, related_name='playlist')
sort = models.CharField(choices=SORT_CHOICES, max_length=255, blank=True)
type = models.CharField(choices=TYPE_CHOICES, max_length=255, blank=True)
mrss = models.CharField(_('mrss'), max_length=255, blank=True, null=True)
json = models.CharField(_('json'), max_length=255, blank=True, null=True)
tags = GenericRelation(TagToObject)
class Meta:
......
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