[charts] Fix chart building
This commit is contained in:
@ -136,3 +136,13 @@ class ChartRecord(TimeStampedModel):
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("charts:charts-home")
|
||||
|
||||
@property
|
||||
def chart_url(self) -> str:
|
||||
url = reverse("charts:charts-home")
|
||||
date_str = str(self.year)
|
||||
if self.week:
|
||||
date_str = f"{self.year}-W{self.week}"
|
||||
elif self.month:
|
||||
date_str = f"{self.year}-{self.month:02d}"
|
||||
return f"{url}?date={date_str}"
|
||||
|
||||
Reference in New Issue
Block a user