Skip to content
Snippets Groups Projects
Verified Commit 9dd531ac authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add first app draft for service rating.

parents
No related branches found
No related tags found
No related merge requests found
from django.contrib import admin
from .models import ServiceCategory, ServiceRating
@admin.register(ServiceCategory)
class ServiceCategoryAdmin(admin.ModelAdmin):
pass
@admin.register(ServiceRating)
class ServiceRatingAdminAdmin(admin.ModelAdmin):
pass
from django.apps import AppConfig
class SchulfreiServiceratingConfig(AppConfig):
name = 'schulfrei_servicerating'
from django.db import models
class ServiceCategory(models.Model):
name = models.CharField(_('Name'), max_length=50, unique=True)
class ServiceRating(models.Model):
name = models.CharField(_('Name'), max_length=50)
url = models.CharField(_('URL'), max_length=50, unique=True)
categories = models.ManyToManyField(ServiceCategory, verbose_name=_('Categories'))
# Ratings - Privacy
rating_privacy_transfer = models.BooleanField(_('No unnecessary data transfer'),
help_text=_('The service does not transfer data to other parties if not necessary for the service itself.'))
rating_privacy_collection = models.BooleanField(_('No unnecessary data collection'),
help_text=_('The service does not (automatically) collect additional data if not necessary for the service itself.'))
rating_privacy_storage = models.BooleanField(_('No unnecessary data storage'),
help_text=_('The service does not store additional data if not necessary for the service itself.'))
# Ratings - ToU
rating_tou_disadvantages = models.BooleanField(_('No legal disadvantages'),
help_text=_('Accepting the ToU does not impose legal disadvantages or cut the rights of the user (e.g. licence grants to the operator).'))
rating_tou_simple = models.BooleanField(_('ToU are easily readable'),
help_text=_('The ToU are written in a manner that is not unnecessarily hard to understand.'))
rating_tou_simple_children = models.BooleanField(_('ToU can be understood by children'),
help_text=_('The ToU are written in a way that children can understand them and give an informed consent.'))
# Ratings - Freedoms in use
rating_use_orgs = models.BooleanField(_('Use allowed for non-profits'),
help_text=_('The service allows usage by non-profit organisations, especially youth organisations.'))
rating_use_schools = models.BooleanField(_('Use allowed for schools'),
help_text=_('The service allows usage by schools and other educational institutions.'))
rating_use_minors = models.BooleanField(_('Use allowed for minors'),
help_text=_('The service allows usage by minors without age restriction, possibly with parental consent.'))
rating_use_unrestricted = models.BooleanField(_('Use allowed without any restrictions'),
help_text=_('The service allows usage without any restrictions at all.'))
# Ratings - Other freedoms
rating_other_foss = models.BooleanField(_('Free software'),
help_text=_('The service consists entirely of free software components.'))
rating_other_contributions = models.BooleanField(_('Contributions are possible'),
help_text=_('The service enables everyone to contribute to the software in use.'))
rating_other_selfhosting = models.BooleanField(_('Self-hosting possible'),
help_text=_('The service can be hosted locally without limitations.'))
@property
def rating_privacy(self):
return 0.34 * (1 if self.rating_privacy_transfer else 6) +
0.33 * (1 if self.rating_privacy_collection else 6) +
0.33 * (1 if self.rating_privacy_storage else 6)
@property
def rating_tou(self):
return 0.60 * (1 if self.rating_tou_disadvantages else 6) +
0.25 * (1 if self.rating_tou_simple else 6) +
0.15 * (1 if self.rating_tou_simple_children else 6)
@property
def rating_use(self):
return 0.25 * (1 if self.rating_use_orgs else 6) +
0.25 * (1 if self.rating_use_schools else 6) +
0.40 * (1 if self.rating_use_minors else 6) +
0.10 * (1 if self.rating_use_unrestricted else 6)
@property
def rating_other(self):
return 0.50 * (1 if self.rating_other_foss else 6) +
0.20 * (1 if self.rating_other_contributions else 6) +
0.30 * (1 if self.rating_other_selfhosting else 6)
@property
def rating_total(self):
return 0.25 * self.rating_privacy +
0.25 * self.rating_tou +
0.30 * self.rating_use +
0.20 * self.rating_other
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