diff --git a/backend/penndata/admin.py b/backend/penndata/admin.py index b427f355..1b4d082e 100644 --- a/backend/penndata/admin.py +++ b/backend/penndata/admin.py @@ -8,6 +8,8 @@ FitnessRoom, FitnessSnapshot, HomePageOrder, + GlobalStat, + IndividualStat ) @@ -25,3 +27,5 @@ def image_tag(self, instance): admin.site.register(FitnessRoom, FitnessRoomAdmin) admin.site.register(FitnessSnapshot) admin.site.register(AnalyticsEvent) +admin.site.register(GlobalStat) +admin.site.register(IndividualStat) diff --git a/backend/penndata/models.py b/backend/penndata/models.py index fb249b52..9720c0ca 100644 --- a/backend/penndata/models.py +++ b/backend/penndata/models.py @@ -117,24 +117,24 @@ def __str__(self): # Adding statistics tracking here -class GlobalStats(models.Model): - stat_key = models.CharField(max_length=50, on_delete=models.CASCADE, +class GlobalStat(models.Model): + stat_key = models.CharField(max_length=50, null=False, blank=False) - stat_value = models.CharField(max_length=50, on_delete=models.CASCADE, + stat_value = models.CharField(max_length=50, null=False, blank=False) year = models.IntegerField() - + class Meta: unique_together = ("stat_key", "year") def __str__(self): return f"Global -- {self.stat_key}-{str(self.year)} : {self.stat_value}" -class IndividualStats(models.Model): +class IndividualStat(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) - stat_key = models.CharField(max_length=50, on_delete=models.CASCADE, + stat_key = models.CharField(max_length=50, null=False, blank=False) - stat_value = models.CharField(max_length=50, on_delete=models.CASCADE, + stat_value = models.CharField(max_length=50, null=False, blank=False) year = models.IntegerField()