forked from shaba/openuds
refactoring and updating models for python 3.7 -- UUIDModel
This commit is contained in:
parent
c13da05baa
commit
77c6857973
@ -39,7 +39,7 @@ from django.http import HttpResponse
|
||||
|
||||
from PIL import Image as PILImage
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.util import getSqlDatetime
|
||||
|
||||
from uds.core.util import encoders
|
||||
|
@ -36,7 +36,7 @@ import typing
|
||||
from django.db import models
|
||||
from uds.core.environment import Environment
|
||||
from uds.core import Module
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -39,7 +39,7 @@ from django.utils.translation import ugettext_noop as _
|
||||
|
||||
from uds.core.util import log
|
||||
from uds.core.util import states
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Tag import TaggingMixin
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.core.util.calendar import CalendarChecker
|
||||
|
@ -38,7 +38,7 @@ from django.db.models import signals
|
||||
|
||||
from uds.models.Transport import Transport
|
||||
from uds.core.util import net
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Tag import TaggingMixin
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ from django.utils.translation import ugettext as _
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.user import User
|
||||
from uds.models.group import Group
|
||||
from uds.models.util import getSqlDatetime
|
||||
|
@ -36,7 +36,7 @@ import requests
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Tag import TaggingMixin
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ from uds.core.environment import Environment
|
||||
from uds.core.util import log
|
||||
from uds.core.util import states
|
||||
from uds.core.services.Exceptions import InvalidServiceException
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Tag import TaggingMixin
|
||||
|
||||
from uds.models.OSManager import OSManager
|
||||
|
@ -35,7 +35,7 @@ import logging
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Image import Image
|
||||
from uds.core.ui.images import DEFAULT_THUMB_BASE64
|
||||
|
||||
|
@ -42,7 +42,7 @@ from uds.core.util import log
|
||||
|
||||
from uds.models.ServicesPool import DeployedService
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -34,7 +34,7 @@ import logging
|
||||
|
||||
|
||||
from django.db import models
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -34,7 +34,7 @@ import logging
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.core.managers import cryptoManager
|
||||
|
||||
|
@ -33,7 +33,7 @@ import typing
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Tag import TaggingMixin
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.models.util import NEVER
|
||||
|
@ -34,7 +34,7 @@ from django.db import models
|
||||
|
||||
from uds.core.util.tools import secondsToTimeString
|
||||
|
||||
from .UUIDModel import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
from .account import Account
|
||||
from .user_service import UserService
|
||||
from .util import NEVER
|
||||
|
@ -32,7 +32,7 @@
|
||||
import logging
|
||||
|
||||
from django.db import models
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.Tag import TaggingMixin
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ from django.db import models
|
||||
|
||||
from uds.core.util import states
|
||||
|
||||
from .UUIDModel import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
from .calendar import Calendar
|
||||
from .ServicesPool import ServicePool
|
||||
from .MetaPool import MetaPool
|
||||
|
@ -43,7 +43,7 @@ from django.db import models
|
||||
from uds.core.util import (calendar, log)
|
||||
|
||||
from .calendar import Calendar
|
||||
from .UUIDModel import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
from .util import getSqlDatetime
|
||||
from .ServicesPool import ServicePool
|
||||
from .Transport import Transport
|
||||
|
@ -39,7 +39,7 @@ from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from dateutil import rrule as rules
|
||||
|
||||
from .UUIDModel import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
from .calendar import Calendar
|
||||
from .util import getSqlDatetime
|
||||
|
||||
|
@ -35,7 +35,7 @@ import logging
|
||||
import typing
|
||||
|
||||
from django.db import models
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.core.util import encoders
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ from django.db.models import signals
|
||||
from uds.core.util.State import State
|
||||
from uds.core.util import log
|
||||
|
||||
from .UUIDModel import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
from .authenticator import Authenticator
|
||||
from .user import User
|
||||
from .util import UnsavedForeignKey, getSqlDatetime
|
||||
|
@ -41,7 +41,7 @@ from uds.models.util import UnsavedForeignKey
|
||||
from uds.models.util import NEVER
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.core.util import log
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
|
||||
# Not imported in runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
|
@ -40,7 +40,7 @@ from uds.core.environment import Environment
|
||||
from uds.core.util import log
|
||||
from uds.core.util import unique
|
||||
from uds.core.util.State import State
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
|
||||
from uds.models.ServicesPool import DeployedService
|
||||
from uds.models.ServicesPoolPublication import DeployedServicePublication
|
||||
|
@ -33,26 +33,22 @@
|
||||
import logging
|
||||
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from uds.core.util.model import generateUuid
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class UUIDModel(models.Model):
|
||||
"""
|
||||
Base abstract model for models that require an uuid
|
||||
"""
|
||||
# pylint: disable=model-missing-unicode
|
||||
uuid = models.CharField(max_length=50, default=None, null=True, unique=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def genUuid(self):
|
||||
def genUuid(self) -> str:
|
||||
return generateUuid()
|
||||
|
||||
# Override default save to add uuid
|
Loading…
Reference in New Issue
Block a user