Skip to content
Snippets Groups Projects
Unverified Commit 533241c2 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add function to list yes/no values for rating.

This is to get two lists inside the template that we can render beautifully.
parent 2e7b95f1
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,17 @@ class ServiceRating(models.Model):
rating_other_selfhosting = models.BooleanField(_('Self-hosting possible'),
help_text=_('The service can be hosted locally without limitations.'))
def yes_no_dict(self):
yes = []
no = []
for field in self._meta.fields:
if field.name.startswith('rating_'):
(yes if getattr(self, field.name) else no).append(
(field.verbose_name, field.help_text))
return (yes, no)
@property
def rating_privacy(self):
return 0.34 * (1 if self.rating_privacy_transfer else 6) + \
......
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