mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-08-26 05:13:58 +02:00
feat(transactions): add filter preset model
This commit is contained in:
@@ -30,12 +30,27 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
transaction_created = Signal()
|
||||
transaction_updated = Signal()
|
||||
transaction_deleted = Signal()
|
||||
|
||||
|
||||
class FilterPreset(models.Model):
|
||||
owner = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="filter_presets",
|
||||
)
|
||||
name = models.CharField(max_length=100)
|
||||
parameters = models.JSONField(default=dict)
|
||||
|
||||
class Meta:
|
||||
ordering = ["name", "id"]
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def transaction_attachment_path(instance, filename):
|
||||
extension = Path(filename).suffix
|
||||
return f"transaction_attachments/{instance.transaction_id}/{instance.id}{extension}"
|
||||
@@ -535,6 +550,7 @@ class Transaction(OwnedObject):
|
||||
|
||||
return new_obj
|
||||
|
||||
|
||||
class TransactionAttachment(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
transaction = models.ForeignKey(
|
||||
@@ -590,6 +606,7 @@ def delete_transaction_attachment_file(sender, instance, **kwargs):
|
||||
if storage.exists(instance.file.name):
|
||||
storage.delete(instance.file.name)
|
||||
|
||||
|
||||
class InstallmentPlan(models.Model):
|
||||
class Recurrence(models.TextChoices):
|
||||
YEARLY = "yearly", _("Yearly")
|
||||
|
||||
Reference in New Issue
Block a user