Commit fb111195 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch '83-career-crash' into 'master'

Test if main partner exists in career index view

Closes #83

See merge request !88
parents 0c5d95dd 9fa63333
......@@ -6,12 +6,16 @@ from random import random
def index(request):
partners = Partner.objects.filter(is_active=True, is_main_partner=False)
context = {
'main_partner': Partner.objects.get(
try:
main_partner = Partner.objects.get(
is_active=True,
is_main_partner=True
),
)
except Partner.DoesNotExist:
main_partner = None
context = {
'main_partner': main_partner,
'partners': sorted(partners, key=lambda x: random()),
}
return render(request, 'partners/index.html', context)
......
Supports Markdown
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