From 61aec4676da1c01331bbc4f44124e6d88b2790ad Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 28 May 2014 18:25:12 +0200 Subject: [PATCH] Remove global project import from stars service. --- taiga/projects/stars/services.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taiga/projects/stars/services.py b/taiga/projects/stars/services.py index 0ed4ef83..1d61b7cf 100644 --- a/taiga/projects/stars/services.py +++ b/taiga/projects/stars/services.py @@ -1,8 +1,8 @@ from django.db.models import F from django.db.transaction import atomic +from django.db.models.loading import get_model from django.contrib.auth import get_user_model -from ..models import Project from .models import Fan, Stars @@ -58,7 +58,9 @@ def get_fans(project_or_id): def get_starred(user_or_id): """Get the projects an user has starred.""" - qs = Project.objects.get_queryset() + project_model = get_model("projects", "Project") + qs = project_model.objects.get_queryset() + if isinstance(user_or_id, int): qs = qs.filter(fans__user_id=user_or_id) else: