Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Filter empty license author entries

Roland Geiderba7406dbc1aa
diff --git a/wger/exercises/models/exercise.py b/wger/exercises/models/exercise.py
index 27b4426ee..50a9af2fe 100644
--- a/wger/exercises/models/exercise.py
+++ b/wger/exercises/models/exercise.py
@@ -63,7 +63,10 @@ class Exercise(AbstractLicenseModel, AbstractHistoryMixin, models.Model):
)
"""The submission date"""
- update_date = models.DateTimeField(_('Date'), auto_now=True)
+ update_date = models.DateTimeField(
+ _('Date'),
+ auto_now=True,
+ )
"""Datetime of the last modification"""
language = models.ForeignKey(
diff --git a/wger/utils/models.py b/wger/utils/models.py
index 09b8af594..2d76d7cfa 100644
--- a/wger/utils/models.py
+++ b/wger/utils/models.py
@@ -106,8 +106,8 @@ def collect_model_author_history(model):
Get unique set of license authors from historical records from model.
"""
out = set()
- for history in set(model.history.all()):
- out.add(history.license_author)
+ for author in [h.license_author for h in set(model.history.all()) if h.license_author]:
+ out.add(author)
return out