context_processors: prevent a null station error when no default station is defined

This commit is contained in:
Chris Tactic 2023-11-24 08:43:34 +01:00
parent 5986d86da3
commit 27b0bec870
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,4 @@
def station(request):
station = request.station
return {"station": station, "audio_streams": station.streams}
audio_streams = station.streams if station else None
return {"station": station, "audio_streams": audio_streams}

View File

@ -1,6 +1,7 @@
from django import forms
from django.forms import ModelForm, ImageField
from ckeditor.fields import RichTextField
from filer.models.imagemodels import Image
from aircox.models import Comment, Program
@ -21,6 +22,7 @@ class CommentForm(ModelForm):
class ProgramForm(ModelForm):
content = RichTextField()
new_cover = ImageField(required=False)
class Meta:

View File

@ -2,6 +2,13 @@
{% load static i18n humanize honeypot aircox %}
{% block head_extra %}
{{ form.media }}
{% endblock %}
{% block init-scripts %}
{% endblock %}
{% block top-nav-tools %}
<a class="navbar-item" href="{% url 'program-detail' object.slug %}" target="_self">
<span class="icon is-small">