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
54e434ba
"git@gitlab.pirati.cz:to/helios-server.git" did not exist on "d37ee8c2af9311f6e2ff26e6931178ed39dd1207"
Commit
54e434ba
authored
2 years ago
by
Tomáš Valenta
Browse files
Options
Downloads
Patches
Plain Diff
add proxy to ARES (no CORS)
parent
3e9935fd
No related branches found
No related tags found
No related merge requests found
Pipeline
#11954
passed
2 years ago
Stage: build
Stage: test_deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
contracts/urls.py
+6
-0
6 additions, 0 deletions
contracts/urls.py
contracts/views.py
+20
-0
20 additions, 0 deletions
contracts/views.py
static_src/admin/signee_form.js
+1
-1
1 addition, 1 deletion
static_src/admin/signee_form.js
with
27 additions
and
1 deletion
contracts/urls.py
+
6
−
0
View file @
54e434ba
...
...
@@ -109,4 +109,10 @@ urlpatterns = [
dal
.
autocomplete
.
Select2QuerySetView
.
as_view
(
model
=
models
.
ContracteeSignature
),
name
=
"
select2_djhacker_contractee_signature_autocomplete
"
,
),
path
(
"
ares-info-proxy/<int:ico>
"
,
views
.
get_ares_info
,
name
=
"
get_ares_info
"
,
)
]
This diff is collapsed.
Click to expand it.
contracts/views.py
+
20
−
0
View file @
54e434ba
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_http_exceptions
import
HTTPExceptions
from
django_downloadview
import
ObjectDownloadView
from
guardian.shortcuts
import
get_objects_for_user
...
...
@@ -368,3 +372,19 @@ def view_signees(request):
# END Submodel listing views
# ARES CORS proxy
def
get_ares_info
(
request
,
ico
:
int
):
if
not
request
.
user
.
is_staff
:
raise
HTTPExceptions
.
FORBIDDEN
ares_info
=
requests
.
get
(
f
"
https://wwwinfo.mfcr.cz/cgi-bin/ares/darv_std.cgi?ico=
{
ico
}
"
)
return
HttpResponse
(
content
=
ares_info
.
content
,
status
=
ares_info
.
status_code
,
content_type
=
ares_info
.
headers
.
get
(
"
Content-Type
"
)
)
This diff is collapsed.
Click to expand it.
static_src/admin/signee_form.js
+
1
−
1
View file @
54e434ba
...
...
@@ -88,7 +88,7 @@ $(window).ready(
const
icoValue
=
$
(
"
#id_ico_number
"
).
val
();
const
rawAresXMLResponse
=
await
fetch
(
`
https://wwwinfo.mfcr.cz/cgi-bin/ares/darv_std.cgi?ico=
${
icoValue
}
`
`
/ares-info-proxy/
${
icoValue
}
`
);
if
(
!
rawAresXMLResponse
.
ok
)
{
...
...
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