equal
deleted
inserted
replaced
|
1 """ |
|
2 models for metacategories and protocol |
|
3 """ |
|
4 from colorful.fields import RGBColorField |
|
5 from django.db import models |
|
6 from django.utils.translation import ugettext_lazy as _ |
|
7 |
|
8 from .base import Model |
|
9 from .auth import GroupProfile |
|
10 |
|
11 |
|
12 class Protocol(Model): |
|
13 title = models.CharField(max_length=255, verbose_name=_('Protocol|title')) |
|
14 group_profile = models.OneToOneField(GroupProfile, on_delete=models.CASCADE) |
|
15 class Meta: |
|
16 verbose_name = _('Protocol') |
|
17 verbose_name_plural = _('Protocols') |
|
18 |
|
19 |
|
20 |
|
21 class Category(models.Model): |
|
22 title = models.CharField(max_length=255, verbose_name=_('Category|title')) |
|
23 color = RGBColorField(verbose_name=_('Category|color')) |
|
24 need_comment = models.BooleanField(default=False, verbose_name=_('Category|need_comment')) |
|
25 description = models.TextField(null=True, blank=True, verbose_name=_('Category|description')) |
|
26 protocol = models.ForeignKey( |
|
27 Protocol, |
|
28 verbose_name=_('Category|protocol'), |
|
29 related_name='categories', |
|
30 on_delete=models.CASCADE |
|
31 ) |
|
32 class Meta: |
|
33 verbose_name = _('Category') |
|
34 verbose_name_plural = _('Categories') |