Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Monitor
Incidents
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
VIPS
VIPSWeb
Commits
61b5e7f6
Commit
61b5e7f6
authored
10 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Fixed message views
parent
e0c8ca67
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
messages/models.py
+8
-8
8 additions, 8 deletions
messages/models.py
messages/views.py
+2
-1
2 additions, 1 deletion
messages/views.py
with
10 additions
and
9 deletions
messages/models.py
+
8
−
8
View file @
61b5e7f6
...
...
@@ -106,11 +106,11 @@ class Message:
return
messages
@staticmethod
def
get_messages
():
def
get_messages
(
current_language
=
settings
.
VIPSLOGIC_LANGUAGE_CODE
):
messages
=
[]
for
item
in
Message
.
get_messages_as_json
():
message
=
Message
.
get_instance_from_dict
(
item
)
message
=
Message
.
get_instance_from_dict
(
item
,
current_language
)
messages
.
append
(
message
)
return
messages
...
...
@@ -130,9 +130,9 @@ class Message:
return
request_result
.
json
()
@staticmethod
def
get_instance_from_dict
(
the_dict
):
message_locale
=
Message
.
get_message_locale
(
the_dict
[
"
messageLocaleSet
"
],
settings
.
VIPSLOGIC_LANGUAGE_CODE
)
message_illustration
=
Message
.
get_illustration
(
the_dict
[
"
messageIllustrationSet
"
],
settings
.
VIPSLOGIC_LANGUAGE_CODE
)
def
get_instance_from_dict
(
the_dict
,
current_language
=
settings
.
VIPSLOGIC_LANGUAGE_CODE
):
message_locale
=
Message
.
get_message_locale
(
the_dict
[
"
messageLocaleSet
"
],
current_language
)
message_illustration
=
Message
.
get_illustration
(
the_dict
[
"
messageIllustrationSet
"
],
current_language
)
created_by
=
""
if
message_locale
.
get
(
"
createdBy
"
,
""
)
!=
""
:
created_by
=
"
%s %s
"
%
(
...
...
@@ -143,9 +143,9 @@ class Message:
return
Message
(
the_dict
[
"
messageId
"
],
the_dict
[
"
organizationId
"
],
message_locale
.
get
(
"
heading
"
,
"
MISSING HEADING FOR LOCALE
'
%s
'"
%
settings
.
VIPSLOGIC_LANGUAGE_CODE
),
message_locale
.
get
(
"
leadParagraph
"
,
"
MISSING LEAD PARAGRAPH FOR LOCALE
'
%s
'"
%
settings
.
VIPSLOGIC_LANGUAGE_CODE
),
message_locale
.
get
(
"
body
"
,
"
MISSING BODY TEXT FOR LOCALE
'
%s
'"
%
settings
.
VIPSLOGIC_LANGUAGE_CODE
),
message_locale
.
get
(
"
heading
"
,
"
MISSING HEADING FOR LOCALE
'
%s
'"
%
current_language
),
message_locale
.
get
(
"
leadParagraph
"
,
"
MISSING LEAD PARAGRAPH FOR LOCALE
'
%s
'"
%
current_language
),
message_locale
.
get
(
"
body
"
,
"
MISSING BODY TEXT FOR LOCALE
'
%s
'"
%
current_language
),
datetime
.
strptime
(
the_dict
[
"
datePub
"
],
settings
.
VIPSLOGIC_DATE_FORMAT
)
,
datetime
.
strptime
(
the_dict
[
"
dateValidTo
"
],
settings
.
VIPSLOGIC_DATE_FORMAT
),
message_illustration
.
get
(
"
file_name
"
,
None
),
...
...
This diff is collapsed.
Click to expand it.
messages/views.py
+
2
−
1
View file @
61b5e7f6
...
...
@@ -17,12 +17,13 @@
#
from
django.shortcuts
import
render
,
get_object_or_404
from
django.utils
import
translation
from
messages.models
import
Message
def
index
(
request
):
context
=
{
'
messages
'
:
Message
.
get_messages
(),
'
messages
'
:
Message
.
get_messages
(
translation
.
get_language
()
),
}
return
render
(
request
,
'
messages/index.html
'
,
context
)
...
...
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