Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
69dd6f70
Commit
69dd6f70
authored
Nov 26, 2019
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing html to pdf
parent
e660fcbc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
9 deletions
+41
-9
app/applicationlayer/management/batchupload/views.py
app/applicationlayer/management/batchupload/views.py
+8
-1
app/helper/email_service/sender.py
app/helper/email_service/sender.py
+14
-0
requirements/local.txt
requirements/local.txt
+19
-8
No files found.
app/applicationlayer/management/batchupload/views.py
View file @
69dd6f70
...
...
@@ -37,7 +37,7 @@ from django.core.files.base import ContentFile
config
=
configparser
.
ConfigParser
()
config_file
=
os
.
path
.
join
(
'./'
,
'env.ini'
)
config
.
read
(
config_file
)
from
django.conf
import
settings
class
BatchUploadViewSet
(
viewsets
.
ModelViewSet
):
queryset
=
ExtractTransformLoad
.
objects
.
all
()
...
...
@@ -98,11 +98,18 @@ class BatchUploadViewSet(viewsets.ModelViewSet):
return
self
.
get_paginated_response
(
message
)
@
action
(
detail
=
False
,
methods
=
[
'get'
],
url_path
=
'pdf-instruction'
,
name
=
'how to upload bulk users'
)
def
testpdf
(
self
,
request
,
code
=
None
):
return
sender
.
to_pdf
()
@
action
(
detail
=
False
,
methods
=
[
'get'
],
url_path
=
'user-instruction'
,
name
=
'how to upload bulk users'
)
def
UserInstruction
(
self
,
request
,
code
=
None
):
sender
.
to_pdf
()
self
.
serializer_class
=
BatchUploadSerializer
queryset
=
MasterAttachment
.
objects
.
filter
(
url__contains
=
config
[
'SETTINGS'
][
'BATCH_UPLOAD_FORMAT_FILENAME'
]
...
...
app/helper/email_service/sender.py
View file @
69dd6f70
...
...
@@ -5,6 +5,20 @@ from app.entities import models
from
django.conf
import
settings
from
django.core
import
mail
as
email_connection
from
django.db
import
transaction
# from weasyprint import HTML
from
io
import
BytesIO
from
django.http
import
HttpResponse
from
django.template.loader
import
get_template
from
xhtml2pdf
import
pisa
def
to_pdf
():
F
=
open
(
os
.
path
.
join
(
settings
.
EMAIL_TEMPLATES_ROOT
,
'RMS-NEWUSER.html'
),
'r'
)
result
=
BytesIO
()
pdf
=
pisa
.
pisaDocument
(
F
,
result
)
if
not
pdf
.
err
:
return
HttpResponse
(
result
.
getvalue
(),
content_type
=
'application/pdf'
)
return
None
@
transaction
.
atomic
...
...
requirements/local.txt
View file @
69dd6f70
aioredis==1.2.0
asgiref==3.2.2
asn1crypto==0.24.0
asn1crypto==0.24.0
astroid==2.2.5
async-timeout==3.0.1
async-timeout==3.0.1
attrs==19.1.0
autobahn==19.9.2
Automat==0.7.0
certifi==2019.6.16
cairocffi==1.1.0
CairoSVG==2.4.2
certifi==2019.6.16
cffi==1.12.3
channels==2.2.0
channels-redis==2.4.0
channels-redis==2.4.0
chardet==3.0.4
colorama==0.4.1
constantly==15.1.0
constantly==15.1.0
cryptography==2.7
cssselect2==0.2.2
daphne==2.3.0
defusedxml==0.6.0
Django==2.2
django-cors-headers==2.5.2
django-filter==2.1.0
django-filter==2.1.0
djangorestframework==3.9.2
drf-renderer-xlsx==0.3.3
drf-writable-nested==0.5.1
et-xmlfile==1.0.1
gevent==1.4.0
greenlet==0.4.15
hiredis==1.0.0
html5lib==1.0.1
hyperlink==19.0.0
idna==2.8
incremental==17.5.0
...
...
@@ -33,7 +39,6 @@ lazy-object-proxy==1.3.1
Markdown==3.1
mccabe==0.6.1
msgpack==0.6.1
drf-renderer-xlsx==0.3.3
mysqlclient==1.4.2.post1
numpy==1.17.3
openpyxl==3.0.0
...
...
@@ -44,16 +49,22 @@ pycodestyle==2.5.0
pycparser==2.19
PyHamcrest==1.9.0
pylint==2.3.1
PyPDF2==1.26.0
Pyphen==0.9.5
python-dateutil==2.8.1
pytz==2018.9
reportlab==3.5.32
requests==2.22.0
six==1.12.0
sqlparse==0.3.0
tinycss2==1.0.2
Twisted==19.7.0
txaio==18.8.1
typed-ast==1.3.1
urllib3==1.25.3
webencodings==0.5.1
websocket==0.2.1
websocket-client==0.54.0
wrapt==1.11.1
zope.interface==4.6.0
\ No newline at end of file
xhtml2pdf==0.2.3
zope.interface==4.6.0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment