fix glitches
This commit is contained in:
		@ -51,15 +51,10 @@ class ScheduleAdmin(admin.ModelAdmin):
 | 
			
		||||
        return obj.get_frequency_verbose()
 | 
			
		||||
    freq.short_description = _('Day')
 | 
			
		||||
 | 
			
		||||
    def rerun(self, obj):
 | 
			
		||||
        return obj.initial is not None
 | 
			
		||||
    rerun.short_description = _('Rerun')
 | 
			
		||||
    rerun.boolean = True
 | 
			
		||||
 | 
			
		||||
    list_filter = ['frequency', 'program']
 | 
			
		||||
    list_display = ['program_title', 'freq', 'time', 'timezone', 'duration',
 | 
			
		||||
                    'rerun']
 | 
			
		||||
    list_editable = ['time', 'duration']
 | 
			
		||||
                    'initial']
 | 
			
		||||
    list_editable = ['time', 'duration', 'initial']
 | 
			
		||||
 | 
			
		||||
    def get_readonly_fields(self, request, obj=None):
 | 
			
		||||
        if obj:
 | 
			
		||||
 | 
			
		||||
@ -16,13 +16,15 @@ class TracksInline(SortableInlineAdminMixin, admin.TabularInline):
 | 
			
		||||
    list_filter = ['artist', 'title', 'tags']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SoundInline(admin.TabularInline):
 | 
			
		||||
    model = Sound
 | 
			
		||||
    fields = ['type', 'path', 'embed', 'duration', 'is_public']
 | 
			
		||||
    readonly_fields = ['type', 'path', 'duration']
 | 
			
		||||
    extra = 0
 | 
			
		||||
 | 
			
		||||
    def get_queryset(self, request):
 | 
			
		||||
        return super().get_queryset(request).available()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@admin.register(Sound)
 | 
			
		||||
class SoundAdmin(admin.ModelAdmin):
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,8 @@ class AdminSite(admin.AdminSite):
 | 
			
		||||
    def each_context(self, request):
 | 
			
		||||
        context = super().each_context(request)
 | 
			
		||||
        context.update({
 | 
			
		||||
            'programs': Program.objects.all().active().values('pk', 'title'),
 | 
			
		||||
            'programs': Program.objects.all().active().values('pk', 'title') \
 | 
			
		||||
                                             .order_by('title'),
 | 
			
		||||
        })
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -23,9 +23,9 @@ class Command (BaseCommand):
 | 
			
		||||
        group = parser.add_argument_group('actions')
 | 
			
		||||
        group.add_argument(
 | 
			
		||||
            '-a', '--age', type=int,
 | 
			
		||||
            default=settings.AIRCOX_LOGS_ARCHIVES_MIN_AGE,
 | 
			
		||||
            default=settings.AIRCOX_LOGS_ARCHIVES_AGE,
 | 
			
		||||
            help='minimal age in days of logs to archive. Default is '
 | 
			
		||||
                 'settings.AIRCOX_LOGS_ARCHIVES_MIN_AGE'
 | 
			
		||||
                 'settings.AIRCOX_LOGS_ARCHIVES_AGE'
 | 
			
		||||
        )
 | 
			
		||||
        group.add_argument(
 | 
			
		||||
            '-f', '--force', action='store_true',
 | 
			
		||||
 | 
			
		||||
@ -15,17 +15,13 @@ def ensure(key, default):
 | 
			
		||||
# group to assign to users at their creation, along with the permissions
 | 
			
		||||
# to add to each group.
 | 
			
		||||
ensure('AIRCOX_DEFAULT_USER_GROUPS', {
 | 
			
		||||
    'Radio Hosts': (
 | 
			
		||||
        'change_program', 'change_diffusion',
 | 
			
		||||
    'radio hosts': (
 | 
			
		||||
        'change_program', 'change_episode', 'change_diffusion',
 | 
			
		||||
        'change_sound',
 | 
			
		||||
        'add_track', 'change_track', 'delete_track',
 | 
			
		||||
        'add_tag', 'change_tag', 'delete_tag',
 | 
			
		||||
        'add_comment', 'edit_comment', 'delete_comment',
 | 
			
		||||
    ),
 | 
			
		||||
    # ensure user can log in using Wagtail
 | 
			
		||||
    'Editors': None,
 | 
			
		||||
    # ensure user can publish
 | 
			
		||||
    'Moderators': None,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
# Directory for the programs data
 | 
			
		||||
@ -50,10 +46,10 @@ ensure('AIRCOX_EPISODE_TITLE_DATE_FORMAT', '%-d %B %Y')
 | 
			
		||||
########################################################################
 | 
			
		||||
# Directory where to save logs' archives
 | 
			
		||||
ensure('AIRCOX_LOGS_ARCHIVES_DIR',
 | 
			
		||||
       os.path.join(AIRCOX_DATA_DIR, 'archives')
 | 
			
		||||
       os.path.join(AIRCOX_DATA_DIR, 'episodes')
 | 
			
		||||
       )
 | 
			
		||||
# In days, minimal age of a log before it is archived
 | 
			
		||||
ensure('AIRCOX_LOGS_ARCHIVES_MIN_AGE', 60)
 | 
			
		||||
ensure('AIRCOX_LOGS_ARCHIVES_AGE', 60)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
########################################################################
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,7 @@
 | 
			
		||||
 | 
			
		||||
                <div class="navbar-item has-dropdown is-hoverable">
 | 
			
		||||
                    <a class="navbar-link" href="{% url "admin:aircox_article_changelist" %}">{% trans "Articles" %}</a>
 | 
			
		||||
                    <div class="navbar-dropdown is-boxed is-right">
 | 
			
		||||
                    <div class="navbar-dropdown is-boxed">
 | 
			
		||||
                        {% for program in programs %}
 | 
			
		||||
                        <a class="navbar-item" href="{% url "admin:aircox_article_changelist" %}?parent={{ program.pk }}">
 | 
			
		||||
                            {{ program.title }}</a>
 | 
			
		||||
@ -54,7 +54,7 @@
 | 
			
		||||
 | 
			
		||||
                <div class="navbar-item has-dropdown is-hoverable">
 | 
			
		||||
                    <a class="navbar-link" href="{% url "admin:aircox_episode_changelist" %}">{% trans "Episodes" %}</a>
 | 
			
		||||
                    <div class="navbar-dropdown is-boxed is-right">
 | 
			
		||||
                    <div class="navbar-dropdown is-boxed">
 | 
			
		||||
                        {% for program in programs %}
 | 
			
		||||
                        <a class="navbar-item" href="{% url "admin:aircox_episode_changelist" %}?parent={{ program.pk }}">
 | 
			
		||||
                            {{ program.title }}</a>
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ tzlocal>=1.4
 | 
			
		||||
mutagen>=1.37
 | 
			
		||||
pyyaml>=3.12
 | 
			
		||||
 | 
			
		||||
django_filter>=2.2.0
 | 
			
		||||
django-taggit>=1.1.0
 | 
			
		||||
django-filer>=1.5.0
 | 
			
		||||
django-ckeditor>=5.7.1
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user