feat(accounts): add option for untracking accounts on a per user basis

This commit is contained in:
Herculino Trotta
2025-08-09 03:35:39 -03:00
parent 7f8261b9cc
commit 55c4b920ee
7 changed files with 48 additions and 22 deletions

View File

@@ -1,11 +1,11 @@
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
from django.utils.translation import gettext_lazy as _
from apps.transactions.models import Transaction
from apps.common.middleware.thread_local import get_current_user
from apps.common.models import SharedObject, SharedObjectManager
from apps.transactions.models import Transaction
class AccountGroup(SharedObject):
@@ -80,7 +80,8 @@ class Account(SharedObject):
def __str__(self):
return self.name
def is_untracked_by(self, user):
def is_untracked_by(self):
user = get_current_user()
return self.untracked_by.filter(pk=user.pk).exists()
def clean(self):