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( |
|
15 # GroupProfile, on_delete=models.CASCADE) |
|
16 |
|
17 class Meta: |
|
18 verbose_name = _('Protocol') |
|
19 verbose_name_plural = _('Protocols') |
|
20 |
|
21 |
|
22 class Category(models.Model): |
|
23 title = models.CharField(max_length=255, verbose_name=_('Category|title')) |
|
24 color = RGBColorField(verbose_name=_('Category|color')) |
|
25 need_comment = models.BooleanField( |
|
26 default=False, |
|
27 verbose_name=_('Category|need_comment') |
|
28 ) |
|
29 description = models.TextField( |
|
30 null=True, |
|
31 blank=True, |
|
32 verbose_name=_('Category|description') |
|
33 ) |
|
34 protocol = models.ForeignKey( |
|
35 Protocol, |
|
36 verbose_name=_('Category|protocol'), |
|
37 related_name='categories', |
|
38 on_delete=models.CASCADE |
|
39 ) |
|
40 |
|
41 class Meta: |
|
42 verbose_name = _('Category') |
|
43 verbose_name_plural = _('Categories') |
|