Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
0d685990
Commit
0d685990
authored
6 years ago
by
Bryan BRANCOTTE
Browse files
Options
Downloads
Patches
Plain Diff
ability to bootstrapize django messages
parent
aba81326
No related branches found
No related tags found
1 merge request
!1
Wizard form
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/templatetags/customtags.py
+13
-1
13 additions, 1 deletion
ippisite/ippidb/templatetags/customtags.py
with
13 additions
and
1 deletion
ippisite/ippidb/templatetags/customtags.py
+
13
−
1
View file @
0d685990
...
...
@@ -2,6 +2,7 @@ import logging
from
django
import
forms
from
django
import
template
from
django.contrib.messages.storage.base
import
Message
from
django.forms.utils
import
ErrorList
from
django.utils.safestring
import
mark_safe
from
django.utils.translation
import
ugettext
...
...
@@ -102,7 +103,18 @@ def bootstrap_core(object):
elif
isinstance
(
object
,
ErrorList
):
for
error
in
object
:
ret
.
append
(
"""
<div class=
"
alert alert-danger
"
>%s</div>
"""
%
error
.
replace
(
"
\n
"
,
"
<br/>
"
))
else
:
elif
isinstance
(
object
,
Message
):
message
=
object
level_tag
=
message
.
level_tag
if
level_tag
==
"
error
"
:
level_tag
=
"
danger
"
elif
level_tag
==
"
debug
"
:
level_tag
=
"
default
"
ret
.
append
(
"""
<div class=
"
alert alert-%s
"
>%s</div>
"""
%
(
level_tag
,
message
.
message
.
replace
(
"
\n
"
,
"
<br/>
"
),
))
elif
len
(
str
(
object
))
>
0
:
ret
.
append
(
"""
<div class=
"
alert alert-danger
"
>Can
'
t bootstrapize object of class %s</div>
"""
%
str
(
type
(
object
).
__name__
))
return
ret
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment