From 98381fb9a3f7248ce9a1c78eabd29a9bdb79ce64 Mon Sep 17 00:00:00 2001 From: Ricardo Lobo Date: Wed, 24 Feb 2016 18:48:53 +0000 Subject: [PATCH] closes issues #1 and #2 --- lcdmarket/api/models.py | 1 - lcdmarket/api/views.py | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lcdmarket/api/models.py b/lcdmarket/api/models.py index 12f31e5..3d18b3d 100644 --- a/lcdmarket/api/models.py +++ b/lcdmarket/api/models.py @@ -7,7 +7,6 @@ from django.utils.text import slugify from django.db.models import Max from django.core.validators import MinLengthValidator, RegexValidator -from lcdmarket.api import states class AccountManager(BaseUserManager): """ diff --git a/lcdmarket/api/views.py b/lcdmarket/api/views.py index f9a254f..3f448c9 100644 --- a/lcdmarket/api/views.py +++ b/lcdmarket/api/views.py @@ -9,8 +9,6 @@ from rest_framework import mixins from rest_framework import permissions from lcdmarket.api import serializers -from lcdmarket.api import permissions as custom_permissions -from lcdmarket.api import utils from rest_framework.response import Response from rest_framework import status from rest_framework.decorators import detail_route, list_route @@ -21,8 +19,7 @@ class AccountViewSet(viewsets.ModelViewSet): """ serializer_class = serializers.AccountSerializer search_fields = ('first_name', 'last_name', 'email') - permission_classes = [custom_permissions.AccountCustomPermission] - ordering_fields = ('id', ) + ordering_fields = ('id', 'balance') ordering = 'id' @list_route() @@ -31,7 +28,9 @@ def me(self, request): return Response(serializer.data) def get_queryset(self): - queryset = models.Account.objects.all() + # @todo improve this, create is_system, and one account and one account + # only must have is_system set to True + queryset = models.Account.objects.exclude(email="system@lcdporto.org") if self.request.user.is_authenticated() and self.request.user.is_admin: return queryset return queryset.filter(is_public=True)