Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
ca7c1b56
Commit
ca7c1b56
authored
Jul 26, 2021
by
Guilhem Saurel
Browse files
drop enum_to_choices
parent
cbc5d9f7
Pipeline
#15316
failed with stage
in 2 minutes and 59 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rainboard/models.py
View file @
ca7c1b56
...
@@ -18,7 +18,7 @@ from django.utils.safestring import mark_safe
...
@@ -18,7 +18,7 @@ from django.utils.safestring import mark_safe
from
github
import
Github
from
github
import
Github
from
gitlab
import
Gitlab
from
gitlab
import
Gitlab
from
ndh.models
import
Links
,
NamedModel
,
TimeStampedModel
from
ndh.models
import
Links
,
NamedModel
,
TimeStampedModel
from
ndh.utils
import
enum_to_choices
,
query_sum
from
ndh.utils
import
query_sum
from
.utils
import
SOURCES
,
api_next
,
invalid_mail
,
slugify_with_dots
,
valid_name
from
.utils
import
SOURCES
,
api_next
,
invalid_mail
,
slugify_with_dots
,
valid_name
...
@@ -76,7 +76,7 @@ class License(models.Model):
...
@@ -76,7 +76,7 @@ class License(models.Model):
class
Forge
(
Links
,
NamedModel
):
class
Forge
(
Links
,
NamedModel
):
source
=
models
.
PositiveSmallIntegerField
(
choices
=
enum_to_choices
(
SOURCES
)
)
source
=
models
.
PositiveSmallIntegerField
(
choices
=
SOURCES
.
choices
)
url
=
models
.
URLField
(
max_length
=
200
)
url
=
models
.
URLField
(
max_length
=
200
)
token
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
,
null
=
True
)
token
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
,
null
=
True
)
verify
=
models
.
BooleanField
(
default
=
True
)
verify
=
models
.
BooleanField
(
default
=
True
)
...
...
rainboard/utils.py
View file @
ca7c1b56
import
logging
import
logging
import
re
import
re
import
unicodedata
import
unicodedata
from
enum
import
IntEnum
import
git
import
git
from
django.utils.safestring
import
mark_safe
from
django.utils.safestring
import
mark_safe
from
django.db.models
import
IntegerChoices
logger
=
logging
.
getLogger
(
'rainboard.utils'
)
logger
=
logging
.
getLogger
(
'rainboard.utils'
)
SOURCES
=
Int
Enum
(
'Sources'
,
'github gitlab redmine robotpkg travis'
)
SOURCES
=
Int
egerChoices
(
'Sources'
,
'github gitlab redmine robotpkg travis'
)
INVALID_MAILS
=
(
'localhost'
,
'none'
,
'noreply'
,
'example'
)
INVALID_MAILS
=
(
'localhost'
,
'none'
,
'noreply'
,
'example'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment