Commit 7c010f23 authored by Sergios Aftsidis's avatar Sergios Aftsidis

Handle strange bug when user is not associated with peer

parent 00ad9a20
......@@ -107,6 +107,17 @@ def dashboard(request):
for peer in peers:
query |= Q(applier__userprofile__in=peer.user_profile.all())
all_group_routes = Route.objects.filter(query)
if all_group_routes is None:
message = 'You have not added any rules yet'
else:
message = 'You are not associated with a peer.'
return render(
request,
'dashboard.html',
{
'message': 'You have not added any rules yet'
}
)
return render(
request,
'dashboard.html',
......@@ -120,7 +131,8 @@ def dashboard(request):
'destinationport',
'sourceport',
'dscp',
)
),
'message': message
},
)
......
......@@ -35,6 +35,7 @@
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class=panel>{{message}}</div>
<ul class="timeline">
{% for route in routes %}
<li class="{% cycle '' 'timeline-inverted' %}">
......
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