@@ -38,41 +38,47 @@ class Migration(migrations.Migration):
3838 ("id" , models .BigAutoField (auto_created = True , primary_key = True , serialize = False )),
3939 ("created" , models .DateTimeField (auto_now_add = True , null = True )),
4040 ("last_updated" , models .DateTimeField (auto_now = True , null = True )),
41- ("custom_field_data" , models .JSONField (
42- blank = True ,
43- default = dict ,
44- encoder = utilities .json .CustomFieldJSONEncoder ,
45- )),
41+ (
42+ "custom_field_data" , models .JSONField (
43+ blank = True ,
44+ default = dict ,
45+ encoder = utilities .json .CustomFieldJSONEncoder ,
46+ )
47+ ),
4648 ("description" , models .CharField (blank = True , max_length = 200 )),
4749 ("comments" , models .TextField (blank = True )),
48- ("name" , models .CharField (
49- max_length = 100 ,
50- unique = True ,
51- validators = [
52- django .core .validators .RegexValidator (
53- message = "Only lowercase alphanumeric characters and underscores are allowed." ,
54- regex = "^[a-z0-9_]+$" ,
55- ),
56- django .core .validators .RegexValidator (
57- flags = re .RegexFlag ["IGNORECASE" ],
58- inverse_match = True ,
59- message = "Double underscores are not permitted in custom object object type names." ,
60- regex = "__" ,
61- )
62- ]
63- )),
50+ (
51+ "name" , models .CharField (
52+ max_length = 100 ,
53+ unique = True ,
54+ validators = [
55+ django .core .validators .RegexValidator (
56+ message = "Only lowercase alphanumeric characters and underscores are allowed." ,
57+ regex = "^[a-z0-9_]+$" ,
58+ ),
59+ django .core .validators .RegexValidator (
60+ flags = re .RegexFlag ["IGNORECASE" ],
61+ inverse_match = True ,
62+ message = "Double underscores are not permitted in custom object object type names." ,
63+ regex = "__" ,
64+ )
65+ ]
66+ )
67+ ),
6468 ("version" , models .CharField (blank = True , max_length = 10 )),
6569 ("verbose_name" , models .CharField (blank = True , max_length = 100 )),
6670 ("verbose_name_plural" , models .CharField (blank = True , max_length = 100 )),
6771 ("slug" , models .SlugField (max_length = 100 , unique = True )),
68- ("object_type" , models .OneToOneField (
69- blank = True ,
70- editable = False ,
71- null = True ,
72- on_delete = django .db .models .deletion .CASCADE ,
73- related_name = "custom_object_types" ,
74- to = "core.objecttype" ,
75- )),
72+ (
73+ "object_type" , models .OneToOneField (
74+ blank = True ,
75+ editable = False ,
76+ null = True ,
77+ on_delete = django .db .models .deletion .CASCADE ,
78+ related_name = "custom_object_types" ,
79+ to = "core.objecttype" ,
80+ )
81+ ),
7682 ("tags" , taggit .managers .TaggableManager (through = "extras.TaggedItem" , to = "extras.Tag" )),
7783 ],
7884 options = {
@@ -89,22 +95,24 @@ class Migration(migrations.Migration):
8995 ("last_updated" , models .DateTimeField (auto_now = True , null = True )),
9096 ("type" , models .CharField (default = "text" , max_length = 50 )),
9197 ("primary" , models .BooleanField (default = False )),
92- ("name" , models .CharField (
93- max_length = 50 ,
94- validators = [
95- django .core .validators .RegexValidator (
96- flags = re .RegexFlag ["IGNORECASE" ],
97- message = "Only alphanumeric characters and underscores are allowed." ,
98- regex = "^[a-z0-9_]+$" ,
99- ),
100- django .core .validators .RegexValidator (
101- flags = re .RegexFlag ["IGNORECASE" ],
102- inverse_match = True ,
103- message = "Double underscores are not permitted in custom object field names." ,
104- regex = "__" ,
105- )
106- ]
107- )),
98+ (
99+ "name" , models .CharField (
100+ max_length = 50 ,
101+ validators = [
102+ django .core .validators .RegexValidator (
103+ flags = re .RegexFlag ["IGNORECASE" ],
104+ message = "Only alphanumeric characters and underscores are allowed." ,
105+ regex = "^[a-z0-9_]+$" ,
106+ ),
107+ django .core .validators .RegexValidator (
108+ flags = re .RegexFlag ["IGNORECASE" ],
109+ inverse_match = True ,
110+ message = "Double underscores are not permitted in custom object field names." ,
111+ regex = "__" ,
112+ )
113+ ]
114+ )
115+ ),
108116 ("label" , models .CharField (blank = True , max_length = 50 )),
109117 ("group_name" , models .CharField (blank = True , max_length = 50 )),
110118 ("description" , models .CharField (blank = True , max_length = 200 )),
@@ -117,33 +125,41 @@ class Migration(migrations.Migration):
117125 ("weight" , models .PositiveSmallIntegerField (default = 100 )),
118126 ("validation_minimum" , models .BigIntegerField (blank = True , null = True )),
119127 ("validation_maximum" , models .BigIntegerField (blank = True , null = True )),
120- ("validation_regex" , models .CharField (
121- blank = True ,
122- max_length = 500 ,
123- validators = [utilities .validators .validate_regex ],
124- )),
128+ (
129+ "validation_regex" , models .CharField (
130+ blank = True ,
131+ max_length = 500 ,
132+ validators = [utilities .validators .validate_regex ],
133+ )
134+ ),
125135 ("ui_visible" , models .CharField (default = "always" , max_length = 50 )),
126136 ("ui_editable" , models .CharField (default = "yes" , max_length = 50 )),
127137 ("is_cloneable" , models .BooleanField (default = False )),
128138 ("comments" , models .TextField (blank = True )),
129- ("choice_set" , models .ForeignKey (
130- blank = True ,
131- null = True ,
132- on_delete = django .db .models .deletion .PROTECT ,
133- related_name = "choices_for_object_type" ,
134- to = "extras.customfieldchoiceset" ,
135- )),
136- ("custom_object_type" , models .ForeignKey (
137- on_delete = django .db .models .deletion .CASCADE ,
138- related_name = "fields" ,
139- to = "netbox_custom_objects.customobjecttype" ,
140- )),
141- ("related_object_type" , models .ForeignKey (
142- blank = True ,
143- null = True ,
144- on_delete = django .db .models .deletion .PROTECT ,
145- to = "core.objecttype" ,
146- )),
139+ (
140+ "choice_set" , models .ForeignKey (
141+ blank = True ,
142+ null = True ,
143+ on_delete = django .db .models .deletion .PROTECT ,
144+ related_name = "choices_for_object_type" ,
145+ to = "extras.customfieldchoiceset" ,
146+ )
147+ ),
148+ (
149+ "custom_object_type" , models .ForeignKey (
150+ on_delete = django .db .models .deletion .CASCADE ,
151+ related_name = "fields" ,
152+ to = "netbox_custom_objects.customobjecttype" ,
153+ )
154+ ),
155+ (
156+ "related_object_type" , models .ForeignKey (
157+ blank = True ,
158+ null = True ,
159+ on_delete = django .db .models .deletion .PROTECT ,
160+ to = "core.objecttype" ,
161+ )
162+ ),
147163 ],
148164 options = {
149165 "verbose_name" : "custom object type field" ,
0 commit comments