Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kontr 2.0
Portal API Backend
Commits
f5875d06
Unverified
Commit
f5875d06
authored
Sep 22, 2018
by
Peter Stanko
Browse files
fixes in the repr
parent
217ef570
Pipeline
#13276
passed with stage
in 25 minutes and 33 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
portal/database/models.py
View file @
f5875d06
...
...
@@ -31,12 +31,14 @@ def _repr(instance) -> str:
Returns(str): String representation of the model
"""
no_include
=
{
'password_hash'
,
'review'
,
'course'
,
'user'
,
'project'
,
'group'
,
'role'
,
'review_items'
}
'review_items'
,
'client'
,
'EXCLUDED'
}
if
'EXCLUDED'
in
vars
(
instance
.
__class__
):
no_include
.
update
(
instance
.
__class__
.
EXCLUDED
)
result
=
f
"
{
instance
.
__class__
.
__name__
}
: "
for
key
,
value
in
vars
(
instance
)
.
items
()
:
for
key
in
dir
(
instance
):
if
not
key
.
startswith
(
"_"
)
and
key
not
in
no_include
:
value
=
getattr
(
instance
,
key
)
if
not
callable
(
value
):
result
+=
f
"
{
key
}
=
{
value
}
"
return
result
...
...
@@ -142,13 +144,13 @@ class Client(db.Model):
return
self
.
id
==
eid
class
Secret
(
db
.
Model
):
class
Secret
(
db
.
Model
,
EntityBase
):
__tablename__
=
'secret'
EXCLUDED
=
[
'value'
,
'client'
]
id
=
db
.
Column
(
db
.
String
(
length
=
36
),
default
=
lambda
:
str
(
uuid
.
uuid4
()),
primary_key
=
True
)
name
=
db
.
Column
(
db
.
String
(
40
),
nullable
=
False
)
value
=
db
.
Column
(
db
.
String
(
120
))
created_at
=
db
.
Column
(
db
.
TIMESTAMP
,
default
=
db
.
func
.
now
())
expires_at
=
db
.
Column
(
db
.
TIMESTAMP
,
nullable
=
True
)
client_id
=
db
.
Column
(
db
.
String
(
36
),
db
.
ForeignKey
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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