diff options
| author | 2021-02-24 08:27:36 +0200 | |
|---|---|---|
| committer | 2021-02-24 08:27:36 +0200 | |
| commit | f731e4dd31f9eba8e8c9916329a5c08578055077 (patch) | |
| tree | 0a8a9f482e85e694302ec5bc4297c2d3d80ee6fe | |
| parent | Update nomination-related tests to cover recent table-splitting changes (diff) | |
Set related_name option of nomination field of NominationEntry
In order to use entries in serializer without manually
setting entries key we have to use related_name option to
automatically fetch all related entries.
| -rw-r--r-- | pydis_site/apps/api/models/bot/nomination.py | 3 | 
1 files changed, 2 insertions, 1 deletions
| diff --git a/pydis_site/apps/api/models/bot/nomination.py b/pydis_site/apps/api/models/bot/nomination.py index ed6f7d81..a813855d 100644 --- a/pydis_site/apps/api/models/bot/nomination.py +++ b/pydis_site/apps/api/models/bot/nomination.py @@ -53,7 +53,8 @@ class NominationEntry(ModelReprMixin, models.Model):      nomination = models.ForeignKey(          Nomination,          on_delete=models.CASCADE, -        help_text="Nomination to what this entry belongs." +        help_text="Nomination to what this entry belongs.", +        related_name="entries"      )      actor = models.ForeignKey(          User, | 
