37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from django.db import models
|
|
from django.utils.translation import gettext_lazy
|
|
|
|
from company.models.location import LocationCode
|
|
from ncircc.enums.notifications import AffectedSystemFunction
|
|
|
|
|
|
class Company(models.Model):
|
|
"""Model with Company information for NCIRCC."""
|
|
|
|
name = models.CharField(gettext_lazy('Name of the organization'), max_length=127)
|
|
is_cii = models.BooleanField(gettext_lazy('Subject CII'), default=False)
|
|
location = models.ForeignKey(
|
|
LocationCode, null=True,
|
|
on_delete=models.SET_NULL,
|
|
verbose_name=gettext_lazy('Country/Region code'),
|
|
)
|
|
city = models.CharField(gettext_lazy('City'), max_length=127)
|
|
affected_system_function = models.CharField(
|
|
gettext_lazy('Affected system function'),
|
|
choices=AffectedSystemFunction.choices,
|
|
default=AffectedSystemFunction.NUCLEAR_POWER.value,
|
|
max_length=127,
|
|
)
|
|
api_key = models.CharField(
|
|
gettext_lazy('Token'),
|
|
max_length=127,
|
|
null=True,
|
|
help_text=gettext_lazy('Token access to NCIRCC API'),
|
|
)
|
|
|
|
class Meta:
|
|
verbose_name = gettext_lazy('Company')
|
|
verbose_name_plural = gettext_lazy('Companies')
|
|
|
|
def __str__(self):
|
|
return self.name
|