Skip to content
Snippets Groups Projects
Commit 2df9990e authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Use id of the respectie ExtraMark and ExcuseType object when using them as column aliases

parent af849ace
No related branches found
No related tags found
2 merge requests!324Resolve "Property count_label of ExcuseType and ExtraMark allowing whitespaces in it breaks usage of it as column alias",!323Prepare release 3.0b0
Pipeline #118890 canceled
...@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file. ...@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_, The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_. and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* In some cases, pages showing the count of extra marks and lessons with custom excuse types of
persons threw an error.
`3.0b0`_ - 2022-02-28 `3.0b0`_ - 2022-02-28
--------------------- ---------------------
......
from datetime import date from datetime import date
from typing import Optional, Union from typing import Optional, Union
from urllib.parse import urlparse from urllib.parse import urlparse
from uuid import uuid4
from django.db import models from django.db import models
from django.db.models.constraints import CheckConstraint from django.db.models.constraints import CheckConstraint
from django.db.models.query_utils import Q from django.db.models.query_utils import Q
from django.urls import reverse from django.urls import reverse
from django.utils.formats import date_format from django.utils.formats import date_format
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from calendarweek import CalendarWeek from calendarweek import CalendarWeek
...@@ -66,7 +68,7 @@ class ExcuseType(ExtensibleModel): ...@@ -66,7 +68,7 @@ class ExcuseType(ExtensibleModel):
@property @property
def count_label(self): def count_label(self):
return f"{self.short_name}_count" return f"excuse_type_{self.id}_count"
class Meta: class Meta:
ordering = ["name"] ordering = ["name"]
...@@ -437,7 +439,7 @@ class ExtraMark(ExtensibleModel): ...@@ -437,7 +439,7 @@ class ExtraMark(ExtensibleModel):
@property @property
def count_label(self): def count_label(self):
return f"{self.short_name}_count" return f"extra_mark_{self.id}_count"
class Meta: class Meta:
ordering = ["short_name"] ordering = ["short_name"]
......
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