Skip to content

Commit

Permalink
fix: prevent use of models inside dynamic preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
saemideluxe committed Apr 4, 2023
1 parent 012c2b7 commit e39e44d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions basxconnect/invoicing/dynamic_preferences_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import htmlgenerator as hg
from basxbread.contrib.document_templates.models import DocumentTemplate
from django.contrib.contenttypes.models import ContentType
from django.forms import ValidationError
from django.utils.translation import gettext_lazy as _
from djmoney import settings
Expand All @@ -17,8 +16,6 @@
StringPreference,
)

from .models import Invoice

invoicing = Section("invoicing", _("Invoicing"))


Expand Down Expand Up @@ -130,7 +127,7 @@ class DefaultInvoiceTemplate(ModelChoicePreference):
section = invoicing
name = "default_invoice_template"
queryset = DocumentTemplate.objects.filter(
model=ContentType.objects.get_for_model(Invoice)
model__app_label="basxconnect_invoicing", model__model="invoice"
)
default = None

Expand All @@ -140,6 +137,6 @@ class DefaultReceiptTemplate(ModelChoicePreference):
section = Section("invoicing")
name = "default_receipt_template"
queryset = DocumentTemplate.objects.filter(
model=ContentType.objects.get_for_model(Invoice)
model__app_label="basxconnect_invoicing", model__model="invoice"
)
default = None

0 comments on commit e39e44d

Please sign in to comment.