2016-12-20 16:43:52 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2017-11-23 06:08:01 +00:00
|
|
|
import uuid
|
|
|
|
|
2016-12-20 16:43:52 +00:00
|
|
|
from django.db import models
|
|
|
|
import logging
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = ['AssetGroup']
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class AssetGroup(models.Model):
|
2017-11-23 06:08:01 +00:00
|
|
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
2016-12-20 16:43:52 +00:00
|
|
|
name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'))
|
2018-01-25 04:16:26 +00:00
|
|
|
created_by = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Created by'))
|
2017-04-07 08:59:09 +00:00
|
|
|
date_created = models.DateTimeField(auto_now_add=True, null=True, verbose_name=_('Date created'))
|
2016-12-20 16:43:52 +00:00
|
|
|
comment = models.TextField(blank=True, verbose_name=_('Comment'))
|
|
|
|
|
2017-12-11 09:08:43 +00:00
|
|
|
def __str__(self):
|
2016-12-20 16:43:52 +00:00
|
|
|
return self.name
|
|
|
|
|
|
|
|
class Meta:
|
2016-12-21 16:36:31 +00:00
|
|
|
ordering = ['name']
|
2018-01-05 09:57:02 +00:00
|
|
|
verbose_name = _("Asset group")
|
2016-12-20 16:43:52 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def initial(cls):
|
|
|
|
asset_group = cls(name=_('Default'), comment=_('Default asset group'))
|
|
|
|
asset_group.save()
|