context_processors: prevent a null station error when no default station is defined
This commit is contained in:
		@ -1,3 +1,4 @@
 | 
				
			|||||||
def station(request):
 | 
					def station(request):
 | 
				
			||||||
    station = request.station
 | 
					    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}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
from django import forms
 | 
					from django import forms
 | 
				
			||||||
from django.forms import ModelForm, ImageField
 | 
					from django.forms import ModelForm, ImageField
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from ckeditor.fields import RichTextField
 | 
				
			||||||
from filer.models.imagemodels import Image
 | 
					from filer.models.imagemodels import Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from aircox.models import Comment, Program
 | 
					from aircox.models import Comment, Program
 | 
				
			||||||
@ -21,6 +22,7 @@ class CommentForm(ModelForm):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ProgramForm(ModelForm):
 | 
					class ProgramForm(ModelForm):
 | 
				
			||||||
 | 
					    content = RichTextField()
 | 
				
			||||||
    new_cover = ImageField(required=False)
 | 
					    new_cover = ImageField(required=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class Meta:
 | 
					    class Meta:
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,13 @@
 | 
				
			|||||||
{% load static i18n humanize honeypot aircox %}
 | 
					{% load static i18n humanize honeypot aircox %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% block head_extra %}
 | 
				
			||||||
 | 
					  {{ form.media }}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% block init-scripts %}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block top-nav-tools %}
 | 
					{% block top-nav-tools %}
 | 
				
			||||||
<a class="navbar-item" href="{% url 'program-detail' object.slug %}" target="_self">
 | 
					<a class="navbar-item" href="{% url 'program-detail' object.slug %}" target="_self">
 | 
				
			||||||
    <span class="icon is-small">
 | 
					    <span class="icon is-small">
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user