Enforce uid with uppercase for Studentcard and test more edge cases

This commit is contained in:
klmp200 committed 2019-05-20 17:56:14 +02:00
1 parent 5ae7d10e84
commit 19e353970d
2 files changed
+50 -1

No files matched your search

+2 -1
View File
@@ -749,7 +749,8 @@ class StudentCard(models.Model):
@staticmethod
def is_valid(uid):
return (
len(uid) == StudentCard.UID_SIZE
uid.isupper()
and len(uid) == StudentCard.UID_SIZE
and not StudentCard.objects.filter(uid=uid).exists()
)