File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 23
23
ProjectRelatedInfoMixin ,
24
24
ProjectThroughModelMixin ,
25
25
)
26
+ from project_manager .common .constants import RELEASE_VERSION_REGEX
26
27
27
28
28
29
# =============================================================================
@@ -187,7 +188,7 @@ class ProjectReleaseViewSet(ProjectRelatedInfoMixin):
187
188
http_method_names = ('get' , 'post' , 'options' )
188
189
ordering = ('-created' ,)
189
190
ordering_fields = ('created' ,)
190
- lookup_value_regex = '[0-9.]+'
191
+ lookup_value_regex = RELEASE_VERSION_REGEX
191
192
lookup_field = 'version'
192
193
193
194
api_type = 'Releases'
Original file line number Diff line number Diff line change 32
32
'RELEASE_NOTES_MAX_LENGTH' ,
33
33
'RELEASE_URL' ,
34
34
'RELEASE_VERSION_MAX_LENGTH' ,
35
+ 'RELEASE_VERSION_REGEX' ,
35
36
'VCS_REQUIREMENT_TYPES' ,
36
37
)
37
38
48
49
PROJECT_SYNOPSIS_MAX_LENGTH = 128
49
50
RELEASE_NOTES_MAX_LENGTH = 512
50
51
RELEASE_VERSION_MAX_LENGTH = 8
52
+ RELEASE_VERSION_REGEX = r'[0-9][0-9a-z.]*[0-9a-z]'
51
53
52
54
# Base URL for project thread
53
55
FORUM_THREAD_URL = settings .FORUM_URL + 'viewtopic.php?t={topic}'
Original file line number Diff line number Diff line change 6
6
# Django
7
7
from django .core .validators import RegexValidator
8
8
9
+ # App
10
+ from project_manager .common .constants import RELEASE_VERSION_REGEX
11
+
9
12
10
13
# =============================================================================
11
14
# >> ALL DECLARATION
29
32
# Start with a number.
30
33
# Contain only numbers, lower-case characters, and decimals.
31
34
# End in a number or lower-case character.
32
- version_validator = RegexValidator (r'^[0-9][0-9a-z.]*[0-9a-z]' )
35
+ version_validator = RegexValidator (r'^' + RELEASE_VERSION_REGEX )
You can’t perform that action at this time.
0 commit comments