src/notes/models/core.py
changeset 126 ba8bc0199464
parent 71 75dc1e794cf4
child 131 adad5563603c
equal deleted inserted replaced
125:c653f49fabfb 126:ba8bc0199464
     1 """
     1 """
     2 irinotes core module
     2 irinotes core module
     3 """
     3 """
       
     4 from auditlog.registry import auditlog
     4 from django.conf import settings
     5 from django.conf import settings
     5 from django.db import models
     6 from django.db import models
     6 from django.utils import timezone
     7 from django.utils import timezone
     7 from django.utils.translation import ugettext_lazy as _
     8 from django.utils.translation import ugettext_lazy as _
     8 
     9 
    37         null=True,
    38         null=True,
    38         blank=True,
    39         blank=True,
    39         verbose_name=_('Session|protocol')
    40         verbose_name=_('Session|protocol')
    40     )
    41     )
    41 
    42 
       
    43     def get_additional_data(self):
       
    44         return {'ext_id': str(self.ext_id)}
       
    45 
       
    46     def __str__(self):
       
    47         return self.title
       
    48 
    42 
    49 
    43 class Note(Model):
    50 class Note(Model):
    44     """
    51     """
    45     Class nodeling a Note
    52     Class nodeling a Note
    46     """
    53     """
    47     class Meta:
    54     class Meta:
    48         verbose_name = _('Note')
    55         verbose_name = _('Note')
    49         verbose_name_plural = _('Notes')
    56         verbose_name_plural = _('Notes')
    50         ordering = ["tc_start"]
    57         ordering = ["tc_start"]
       
    58 
       
    59     def get_additional_data(self):
       
    60         return {'ext_id': str(self.ext_id)}
    51 
    61 
    52     tc_start = models.DateTimeField(verbose_name=_('Note|tc_start'))
    62     tc_start = models.DateTimeField(verbose_name=_('Note|tc_start'))
    53     tc_end = models.DateTimeField(verbose_name=_('Note|tc_end'))
    63     tc_end = models.DateTimeField(verbose_name=_('Note|tc_end'))
    54     session = models.ForeignKey(
    64     session = models.ForeignKey(
    55         Session,
    65         Session,
    80     categorization = models.TextField(
    90     categorization = models.TextField(
    81         null=True,
    91         null=True,
    82         blank=True,
    92         blank=True,
    83         verbose_name=_('Note|categorization')
    93         verbose_name=_('Note|categorization')
    84     )
    94     )
       
    95 auditlog.register(Session)
       
    96 auditlog.register(Note)