Skip to content

Commit

Permalink
closes issues #1 and #2
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardolobo committed Feb 24, 2016
1 parent 847d5af commit 98381fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion lcdmarket/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
9 changes: 4 additions & 5 deletions lcdmarket/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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="[email protected]")
if self.request.user.is_authenticated() and self.request.user.is_admin:
return queryset
return queryset.filter(is_public=True)
Expand Down

0 comments on commit 98381fb

Please sign in to comment.