Commit a826af4f authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Moved a class to a specific model file

parent 52d87ab0
from .. import models
class State(object):
def __init__(self, user):
if user.is_authenticated:
self.services = models.Service.objects.filter(
groups__user=user
)
else:
self.services = []
......@@ -8,7 +8,7 @@ from rest_framework.authentication import TokenAuthentication
from rest_framework.response import Response
from rest_framework import status
from . import serializers
from . import serializers, models as frontend_models
from .. import models
......@@ -48,7 +48,7 @@ class StateView(views.APIView):
response['user'] = serializers.UserSerializer(request.user).data
response['state'] = serializers.StateSerializer(
models.State(request.user)).data
frontend_models.State(request.user)).data
return Response(response)
......
......@@ -94,17 +94,6 @@ class SSHPublicKey(models.Model):
return self.name
class State(object):
def __init__(self, user):
if user.is_authenticated:
self.services = Service.objects.filter(
groups__user=user
)
else:
self.services = []
class Deployment(models.Model):
user = models.ForeignKey(
User,
......
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