Commit b32c81ae authored by Stauros Kroustouris's avatar Stauros Kroustouris

fix profile layout and minor bug in viewsets

parent 335a03c2
......@@ -26,13 +26,21 @@ class RouteViewSet(viewsets.ModelViewSet):
serializer_class = RouteSerializer
def get_queryset(self):
if settings.DEBUG:
if self.request.user.is_anonymous():
return Route.objects.all()
elif self.request.user.is_authenticated():
return Route.objects.filter(applier=self.request.user)
raise Exception('User is not Authenticated')
if self.request.user.is_superuser:
return Route.objects.all()
elif self.request.user.is_authenticated and not self.request.user.is_anonymous:
return Route.objects.filter(applier=self.request.user)
def list(self, request):
serializer = RouteSerializer(self.get_queryset(), many=True)
serializer = RouteSerializer(self.get_queryset(), many=True, context={'request': request})
return Response(
def retrieve(self, request, pk=None):
......@@ -64,9 +64,15 @@
<dl class="dl-horizontal">
<dt>{% trans "Username" %}:</dt>
{% if user.first_name %}
<dt>{% trans "First name" %}:</dt><dd>{{user.first_name}}</dd>
{% endif %}
{% if user.last_name %}
<dt>{% trans "Last name" %}:</dt><dd>{{user.last_name}}</dd>
{% endif %}
{% if %}
<dt>{% trans "Email" %}:</dt><dd>{{}}</dd>
{% endif %}
<dt>{% trans "Api Token" %}:</dt>
{% if user.auth_token %}
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