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
b83a0501
Commit
b83a0501
authored
4 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Added 404 to information cms system
parent
d260a109
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
information/views.py
+22
-16
22 additions, 16 deletions
information/views.py
with
22 additions
and
16 deletions
information/views.py
+
22
−
16
View file @
b83a0501
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
#
#
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.http
import
Http404
from
information.models
import
InformationLocale
,
Information
from
information.models
import
InformationLocale
,
Information
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
...
@@ -32,22 +34,26 @@ def index(request):
...
@@ -32,22 +34,26 @@ def index(request):
return
render
(
request
,
'
information/index.html
'
,
context
)
return
render
(
request
,
'
information/index.html
'
,
context
)
def
detail
(
request
,
information_id
):
def
detail
(
request
,
information_id
):
information_locale
=
InformationLocale
.
get_information_locale_with_fallback
(
information_id
,
request
.
LANGUAGE_CODE
)
try
:
# Is there a parent?
information_locale
=
InformationLocale
.
get_information_locale_with_fallback
(
information_id
,
request
.
LANGUAGE_CODE
)
#parent_information = information_locale.information.parent_information
# Is there a parent?
# We get all the children too
#parent_information = information_locale.information.parent_information
#children_locales = []
# We get all the children too
#for child in information_locale.information.children.all():
#children_locales = []
# children_locales.append(InformationLocale.get_information_locale_with_fallback(child.pk))
#for child in information_locale.information.children.all():
# children_locales.append(InformationLocale.get_information_locale_with_fallback(child.pk))
context
=
{
'
information_locale
'
:
information_locale
,
context
=
{
#'parent_information' : parent_information,
'
information_locale
'
:
information_locale
,
#'children_locales':children_locales,
#'parent_information' : parent_information,
'
breadcrumb
'
:
get_breadcrumb
(
information_locale
.
information
,
request
.
LANGUAGE_CODE
),
#'children_locales':children_locales,
'
menu_html
'
:
get_menu_html
(
None
,
information_id
,
request
.
LANGUAGE_CODE
)
'
breadcrumb
'
:
get_breadcrumb
(
information_locale
.
information
,
request
.
LANGUAGE_CODE
),
}
'
menu_html
'
:
get_menu_html
(
None
,
information_id
,
request
.
LANGUAGE_CODE
)
return
render
(
request
,
'
information/detail.html
'
,
context
)
}
return
render
(
request
,
'
information/detail.html
'
,
context
)
except
ObjectDoesNotExist
:
raise
Http404
(
"
No information page found with id=%s
"
%
information_id
)
def
get_breadcrumb
(
information
,
language
):
def
get_breadcrumb
(
information
,
language
):
active_id
=
information
.
pk
active_id
=
information
.
pk
...
...
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