Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Public contract registry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
TO
Public contract registry
Commits
180baa61
Commit
180baa61
authored
2 years ago
by
Tomáš Valenta
Browse files
Options
Downloads
Patches
Plain Diff
raise 404 if model inexistent
parent
5ab07d5b
No related branches found
No related tags found
No related merge requests found
Pipeline
#12131
passed
2 years ago
Stage: build
Stage: test_deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
contracts/views.py
+23
-12
23 additions, 12 deletions
contracts/views.py
with
23 additions
and
12 deletions
contracts/views.py
+
23
−
12
View file @
180baa61
...
...
@@ -4,7 +4,7 @@ import requests
from
django.conf
import
settings
from
django.core.paginator
import
Paginator
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.shortcuts
import
get_object_or_404
,
render
from
django_downloadview
import
ObjectDownloadView
from
django_http_exceptions
import
HTTPExceptions
from
guardian.shortcuts
import
get_objects_for_user
...
...
@@ -89,10 +89,12 @@ def view_contract(request, id: int):
if
not
request
.
user
.
has_perm
(
"
contracts.view_confidential
"
):
filter
[
"
is_public
"
]
=
True
contract
=
(
contract
=
get_object_or_404
(
(
get_objects_for_user
(
request
.
user
,
"
contracts.view_contract
"
)
.
filter
(
**
filter
)
.
get
(
id
=
id
)
),
id
=
id
)
return
render
(
...
...
@@ -111,9 +113,10 @@ def view_contract(request, id: int):
def
view_contract_filing_area
(
request
,
id
:
int
):
filing_area
=
get_objects_for_user
(
request
.
user
,
"
contracts.view_contractfilingarea
"
).
get
(
id
=
id
)
filing_area
=
get_object_or_404
(
get_objects_for_user
(
request
.
user
,
"
contracts.view_contractfilingarea
"
),
id
=
id
)
contracts_page
,
contracts_paginator
=
get_paginated_contracts
(
request
,
{
"
filing_area
"
:
filing_area
}
...
...
@@ -137,7 +140,8 @@ def view_contract_filing_area(request, id: int):
def
view_contract_issue
(
request
,
id
:
int
):
issue
=
get_objects_for_user
(
request
.
user
,
"
contracts.view_contractissue
"
).
get
(
issue
=
get_object_or_404
(
get_objects_for_user
(
request
.
user
,
"
contracts.view_contractissue
"
),
id
=
id
)
...
...
@@ -160,7 +164,10 @@ def view_contract_issue(request, id: int):
def
view_contract_type
(
request
,
id
:
int
):
type_
=
get_objects_for_user
(
request
.
user
,
"
contracts.view_contracttype
"
).
get
(
id
=
id
)
type_
=
get_object_or_404
(
get_objects_for_user
(
request
.
user
,
"
contracts.view_contracttype
"
),
id
=
id
)
contracts_page
,
contracts_paginator
=
get_paginated_contracts
(
request
,
{
"
types
"
:
type_
}
...
...
@@ -181,7 +188,8 @@ def view_contract_type(request, id: int):
def
view_contractee
(
request
,
id
:
int
):
contractee
=
get_objects_for_user
(
request
.
user
,
"
contracts.view_contractee
"
).
get
(
contractee
=
get_object_or_404
(
get_objects_for_user
(
request
.
user
,
"
contracts.view_contractee
"
),
id
=
id
)
...
...
@@ -204,7 +212,10 @@ def view_contractee(request, id: int):
def
view_signee
(
request
,
id
:
int
):
signee
=
get_objects_for_user
(
request
.
user
,
"
contracts.view_signee
"
).
get
(
id
=
id
)
signee
=
get_object_or_404
(
get_objects_for_user
(
request
.
user
,
"
contracts.view_signee
"
),
id
=
id
)
contracts_page
,
contracts_paginator
=
get_paginated_contracts
(
request
,
{
"
signee_signatures__signee
"
:
signee
}
...
...
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