Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Resint
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mike Gabriel
AlekSIS-App-Resint
Compare revisions
master to f4d9a99048117d085ef186f48296c527c5886c00
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
sunweaver/AlekSIS-App-Resint
Select target project
No results found
f4d9a99048117d085ef186f48296c527c5886c00
Select Git revision
Swap
Target
AlekSIS/official/AlekSIS-App-Resint
Select target project
AlekSIS/official/AlekSIS-App-Resint
sunweaver/AlekSIS-App-Resint
2 results
master
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
Add API view for accessing the PDF file of live documents
· f4d9a990
Jonathan Weth
authored
3 years ago
(cherry picked from commit
a43f2d7b
)
f4d9a990
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/resint/urls.py
+6
-0
6 additions, 0 deletions
aleksis/apps/resint/urls.py
aleksis/apps/resint/views.py
+14
-4
14 additions, 4 deletions
aleksis/apps/resint/views.py
with
20 additions
and
4 deletions
aleksis/apps/resint/urls.py
View file @
f4d9a990
...
...
@@ -5,6 +5,7 @@ from .views import (
LiveDocumentDeleteView
,
LiveDocumentEditView
,
LiveDocumentListView
,
LiveDocumentShowAPIView
,
LiveDocumentShowView
,
PosterCurrentView
,
PosterDeleteView
,
...
...
@@ -42,4 +43,9 @@ urlpatterns = [
path
(
"
live_documents/<str:slug>.pdf
"
,
LiveDocumentShowView
.
as_view
(),
name
=
"
show_live_document
"
,
),
path
(
"
api/live_documents/<str:slug>.pdf
"
,
LiveDocumentShowAPIView
.
as_view
(),
name
=
"
api_show_live_document
"
,
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/resint/views.py
View file @
f4d9a990
...
...
@@ -15,6 +15,7 @@ from django.views.generic.list import ListView
from
django_tables2
import
SingleTableView
from
guardian.shortcuts
import
get_objects_for_user
from
oauth2_provider.views.mixins
import
ClientProtectedResourceMixin
from
reversion.views
import
RevisionMixin
from
rules.contrib.views
import
PermissionRequiredMixin
...
...
@@ -221,15 +222,24 @@ class LiveDocumentDeleteView(PermissionRequiredMixin, RevisionMixin, AdvancedDel
success_message
=
_
(
"
The live document has been deleted.
"
)
class
LiveDocumentShowView
(
PermissionRequiredMixin
,
SingleObjectMixin
,
View
):
"""
Show the current version of the
live document.
"""
class
LiveDocumentShow
Base
View
(
SingleObjectMixin
,
View
):
"""
Base view for showing
live document
s
.
"""
model
=
LiveDocument
permission_required
=
"
resint.view_livedocument_rule
"
def
get
(
self
,
request
:
HttpRequest
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
FileResponse
:
live_document
=
self
.
get_object
()
file
=
live_document
.
get_current_file
()
if
not
file
:
raise
Http404
return
FileResponse
(
file
.
file
,
content_type
=
"
application/pdf
"
)
return
FileResponse
(
file
,
content_type
=
"
application/pdf
"
)
class
LiveDocumentShowView
(
PermissionRequiredMixin
,
LiveDocumentShowBaseView
):
"""
Show the current version of the live document.
"""
permission_required
=
"
resint.view_livedocument_rule
"
class
LiveDocumentShowAPIView
(
ClientProtectedResourceMixin
,
LiveDocumentShowBaseView
):
"""
Show the current version of the live document in API.
"""
This diff is collapsed.
Click to expand it.