Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Feature/SK-510 | Create clients using studio-cli (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklastheman committed Jun 28, 2023
1 parent 35f3cd6 commit cfb9a54
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ def user_can_create(self, user):
or has_perm
)

def get_projects_from_user(self, user):
return self.filter(Q(owner=user) | Q(authorized=user)).distinct()

def get_project(self, user, slug=None, id=None):
qs = (
self.filter(Q(owner=user) | Q(authorized=user), pk=id)
if id is not None
else self.filter(Q(owner=user) | Q(authorized=user), slug=slug)
)

return qs.first() if qs.count() != 0 else None


def get_random_pattern_class():
randint = random.randint(1, 12)
Expand Down

0 comments on commit cfb9a54

Please sign in to comment.