Skip to content

Commit

Permalink
Fix linter/formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusselsmark committed Jan 12, 2025
1 parent 863d875 commit 04b9542
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
5 changes: 3 additions & 2 deletions members/admin/person_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.db.models import Q
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.urls import path
from django.utils.html import format_html

from members.models import (
Expand Down Expand Up @@ -232,7 +231,9 @@ class MassConfirmForm(forms.Form):
confirmation = forms.BooleanField(
label="Jeg godkender at ovenstående personer anonymiseres",
required=True,
widget=forms.CheckboxInput(attrs={'style': 'color: blue; width: unset;'})
widget=forms.CheckboxInput(
attrs={"style": "color: blue; width: unset;"}
),
)

persons = queryset
Expand Down
4 changes: 1 addition & 3 deletions members/models/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ def save(self, *args, **kwargs):
def anonymize(self):
non_anonymized_persons_in_family = self.person_set.filter(anonymized=False)
if non_anonymized_persons_in_family.count() != 0:
raise Exception(
"Cannot anonymize family with non-anonymized persons."
)
raise Exception("Cannot anonymize family with non-anonymized persons.")

self.email = f"anonym-{self.id}@codingpirates.dk"
self.dont_send_mails = True
Expand Down
5 changes: 3 additions & 2 deletions members/models/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,13 @@ def anonymize(self):
self.birthday = self.birthday.replace(day=random.randint(1, 28))

self.notes = ""
self.address_invalid = True # don't try to update address for anonymized persons
self.address_invalid = (
True # don't try to update address for anonymized persons
)
self.anonymized = True
self.save()

self.family.anonymize_if_all_persons_anonymized()


firstname.admin_order_field = "name"
firstname.short_description = "Fornavn"
4 changes: 2 additions & 2 deletions members/tests/test_model_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def test_cannot_anonymize_family_with_non_anonymized_members(self):
person = PersonFactory(family=family)

with self.assertRaises(
Exception,
msg="Cannot anonymize family with non-anonymized persons."):
Exception, msg="Cannot anonymize family with non-anonymized persons."
):
family.anonymize()
4 changes: 2 additions & 2 deletions members/tests/test_model_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_anonymize_person_in_single_member_family(self):
self.assertTrue(person.anonymized)
self.assertEqual(person.name, "Anonymiseret")
self.assertEqual(person.zipcode, "")
self.assertEqual(person.municipality, municipality) # should not be changed
self.assertEqual(person.municipality, municipality) # should not be changed

self.assertIsNotNone(person.birthday)

Expand Down Expand Up @@ -126,7 +126,7 @@ def test_anonymize_all_persons_in_multi_member_family(self):
person_1.anonymize()

self.assertTrue(person_1.anonymized)
self.assertFalse(person_1.family.anonymized) # not yet anonymized
self.assertFalse(person_1.family.anonymized) # not yet anonymized

person_2.anonymize()

Expand Down

0 comments on commit 04b9542

Please sign in to comment.