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
hackinscience
hkis-website
Commits
8313cef5
Unverified
Commit
8313cef5
authored
Oct 05, 2021
by
Julien Palard
Browse files
admin: Better truncation of correction message in list view.
parent
d74d3523
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/models.py
View file @
8313cef5
...
...
@@ -7,6 +7,7 @@ from django.db import models, IntegrityError
from
django.db.models
import
Count
,
Value
,
Q
,
Min
,
Sum
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django.template.defaultfilters
import
truncatechars
from
django.urls
import
reverse
from
django.utils.text
import
Truncator
from
django.utils.timezone
import
now
...
...
@@ -267,7 +268,7 @@ class Answer(models.Model):
votes
=
models
.
IntegerField
(
default
=
0
,
blank
=
True
,
null
=
False
)
# Sum of Vote.value
def
short_correction_message
(
self
):
return
self
.
correction_message
.
strip
().
split
(
"
\n
"
)[
:
1
][:
100
]
return
truncatechars
(
self
.
correction_message
.
strip
().
split
(
"
\n
"
)[
0
],
100
)
def
__str__
(
self
):
return
"{} on {}"
.
format
(
...
...
Write
Preview
Supports
Markdown
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