forked from Dieterbe/anthracite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
19 lines (17 loc) · 643 Bytes
/
model.py
File metadata and controls
19 lines (17 loc) · 643 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Attribute:
'''
choices:
* False: freeform input
* []: must be one of the values in the list
* a list with 1 value means "has this value, and is not editable by user"
'''
def __init__(self, key, label, mandatory=False, choices=False, select_many=False):
self.key = key
self.label = label
self.mandatory = mandatory
self.choices = choices
self.select_many = select_many
def freeform(self):
return (type(self.choices) is not list)
def __str__(self):
return "Attribute(key '%s', label '%s', mandatory %s)" % (self.key, self.label, self.mandatory)