Skip to content
Snippets Groups Projects
Verified Commit 30e664a2 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix distinct bug and fix display of validity

parent 0dff79e9
No related branches found
No related tags found
No related merge requests found
Pipeline #84055 failed
...@@ -65,7 +65,7 @@ class CardIssueForm(forms.Form): ...@@ -65,7 +65,7 @@ class CardIssueForm(forms.Form):
cleaned_data["all_persons"] = Person.objects.filter( cleaned_data["all_persons"] = Person.objects.filter(
Q(pk__in=cleaned_data.get("persons", [])) Q(pk__in=cleaned_data.get("persons", []))
| Q(member_of__in=cleaned_data.get("groups", [])) | Q(member_of__in=cleaned_data.get("groups", []))
) ).distinct()
if not cleaned_data["all_persons"].exists(): if not cleaned_data["all_persons"].exists():
raise forms.ValidationError(_("The selected groups don't have any members.")) raise forms.ValidationError(_("The selected groups don't have any members."))
......
...@@ -270,7 +270,7 @@ class Card(ExtensibleModel): ...@@ -270,7 +270,7 @@ class Card(ExtensibleModel):
@property @property
def is_valid(self): def is_valid(self):
return ( return (
self.valid_until <= timezone.now().date() and not self.deactivated and self.chip_number self.valid_until >= timezone.now().date() and not self.deactivated and self.chip_number
) )
def deactivate(self): def deactivate(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment