/
choices.py
58 lines (42 loc) · 1.15 KB
/
choices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
from dj.choices import Choices
class DataCenterAssetStatus(Choices):
_ = Choices.Choice
new = _('new')
used = _('in use')
free = _('free')
damaged = _('damaged')
liquidated = _('liquidated')
to_deploy = _('to deploy')
cleaned = _('cleaned')
pre_liquidated = _("pre liquidated")
class Orientation(Choices):
_ = Choices.Choice
DEPTH = Choices.Group(0)
front = _("front")
back = _("back")
middle = _("middle")
WIDTH = Choices.Group(100)
left = _("left")
right = _("right")
@classmethod
def is_width(cls, orientation):
is_width = orientation in set(
[choice.id for choice in cls.WIDTH.choices]
)
return is_width
@classmethod
def is_depth(cls, orientation):
is_depth = orientation in set(
[choice.id for choice in cls.DEPTH.choices]
)
return is_depth
class RackOrientation(Choices):
_ = Choices.Choice
top = _("top")
bottom = _("bottom")
left = _("left")
right = _("right")
class ConnectionType(Choices):
_ = Choices.Choice
network = _("network connection")