Skip to content
Snippets Groups Projects
Commit ad89093b authored by Brody Wilton's avatar Brody Wilton Committed by Brody Wilton
Browse files

Implement basic version of report generation

parent c2c7725a
No related branches found
No related tags found
1 merge request!16update requirements txt to include library for pdf creation, comment out...
......@@ -232,12 +232,14 @@
required
/>
</div>
<a href="{% url 'generate_pdf' %}"
<button
type="submit"
class="p-2 bg-blue-500 text-white rounded-md hover:bg-blue-600"
>
Download Financial Statement
</button>
</a>
</form>
{% comment %} REPLACE WITH LOGIC TO CHECK PROPER USER {% endcomment %}
</div>
......
......@@ -12,6 +12,7 @@ from .views import handling_music_file
from .views import pricing
from .views import generate_pdf
urlpatterns = [
# path('', index, name='index'), <- uncomment when index/main page will be ready
......@@ -26,5 +27,6 @@ urlpatterns = [
path('pricay_policy/', privacy_policy, name='privacy_policy'),
path('pricing/', pricing, name='pricing'),
path('uploading_file/', handling_music_file, name='uploading_file'),
,
path('generate_pdf/', generate_pdf, name='generate_pdf')
]
......@@ -80,3 +80,15 @@ def privacy_policy(request):
def pricing(request):
return render(request, 'pricing.html')
#For testing the receipts ONLY. TODO: delete when working
def generate_pdf(request):
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="example.pdf"'
p = canvas.Canvas(response)
p.drawString(100, 800, "Hello, this is a PDF!")
p.showPage()
p.save()
return response
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment