Tinymce_2
This commit is contained in:
parent
1484d6cc6d
commit
cf3f996163
1 changed files with 1 additions and 19 deletions
20
cms/views.py
20
cms/views.py
|
|
@ -176,25 +176,7 @@ class DocumentListView(ListView):
|
||||||
class DocumentDetailView(DetailView):
|
class DocumentDetailView(DetailView):
|
||||||
template_name ='cms/document_detail.html'
|
template_name ='cms/document_detail.html'
|
||||||
model = Document
|
model = Document
|
||||||
|
|
||||||
def get_object(self):
|
|
||||||
if self.docfile <> '':
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def render_to_response(self, context, **response_kwards):
|
|
||||||
print('============')
|
|
||||||
print(self.object.docfile)
|
|
||||||
if self.object.docfile == '':
|
|
||||||
print('docfile = vide')
|
|
||||||
return
|
|
||||||
pdf_file = settings.MEDIA_ROOT + '/media/EDS_Calendrier_2017.pdf'
|
|
||||||
with open(pdf_file, 'rb') as pdf:
|
|
||||||
response = HttpResponse(pdf.read(),content_type='application/pdf')
|
|
||||||
response['Content-Disposition'] = 'filename=some_file.pdf'
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pdf_view(request):
|
def pdf_view(request):
|
||||||
with open('/path/to/my/file.pdf', 'r') as pdf:
|
with open('/path/to/my/file.pdf', 'r') as pdf:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue