Skip to content

Commit

Permalink
add is_active filter for intendeduse & remove default queryset filter
Browse files Browse the repository at this point in the history
  • Loading branch information
henrinie-nc committed Nov 7, 2024
1 parent 273c69f commit 5ab4193
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion leasing/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class IntendedUseFilter(FilterSet):

class Meta:
model = IntendedUse
fields = ["service_unit"]
fields = ["service_unit", "is_active"]


class InvoiceFilter(FilterSet):
Expand Down
9 changes: 1 addition & 8 deletions leasing/models/lease.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ def __str__(self):
return "{} ({})".format(self.name, self.identifier)


class IntendedUseManager(models.Manager):
def get_queryset(self):
# By default, only return active IntendedUses
return super().get_queryset().filter(is_active=True)


class IntendedUse(NameModel):
"""
In Finnish: Käyttötarkoitus
Expand All @@ -150,7 +144,6 @@ class IntendedUse(NameModel):
help_text=_("Is the intended use active?"),
verbose_name=_("Is active?"),
)
objects = IntendedUseManager()

class Meta(NameModel.Meta):
verbose_name = pgettext_lazy("Model name", "Intended use")
Expand Down Expand Up @@ -805,7 +798,7 @@ def get_tenant_shares_for_period( # noqa C901 TODO
(billing_overlap, billing_remainders) = get_range_overlap_and_remainder(
tenant_overlap[0],
tenant_overlap[1],
*billing_tenantcontact.date_range
*billing_tenantcontact.date_range,
)

if not billing_overlap:
Expand Down

0 comments on commit 5ab4193

Please sign in to comment.