From 4aa7b09db90ae052f042d2cd62a4e10838a5b2ca Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Thu, 28 Jun 2018 20:20:08 +0200 Subject: [PATCH] Printer App a beginning. --- printer/models.py | 3 +++ printer/templates/printer/newjob.html | 2 +- re2o/settings.py | 1 + re2o/urls.py | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/printer/models.py b/printer/models.py index 34657a58..e64343b2 100644 --- a/printer/models.py +++ b/printer/models.py @@ -43,6 +43,9 @@ import math """ +def user_printing_path(instance, filename): + # File will be uploaded to MEDIA_ROOT/printings/user_/ + return 'printings/user_{0}/{1}'.format(instance.user.id, filename) class JobWithOptions(RevMixin, models.Model): """ diff --git a/printer/templates/printer/newjob.html b/printer/templates/printer/newjob.html index 55d32a18..223ea481 100644 --- a/printer/templates/printer/newjob.html +++ b/printer/templates/printer/newjob.html @@ -67,8 +67,8 @@ job.parentNode.removeChild(job); document.getElementById('id_form-TOTAL_FORMS').value --; } - + function add_listener_for_btn(rmBtn){ rmBtn.addEventListener("click", function(event){del_job(rmBtn.parentNode, event)}); diff --git a/re2o/settings.py b/re2o/settings.py index 2fa91b34..eb4db096 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -77,6 +77,7 @@ LOCAL_APPS = ( 're2o', 'preferences', 'logs', + 'printer', ) INSTALLED_APPS = ( DJANGO_CONTRIB_APPS + diff --git a/re2o/urls.py b/re2o/urls.py index d8bb289f..e55fe2e4 100644 --- a/re2o/urls.py +++ b/re2o/urls.py @@ -74,6 +74,7 @@ urlpatterns = [ r'^preferences/', include('preferences.urls', namespace='preferences') ), + url(r'^printer/', include('printer.urls', namespace='printer')), ] # Add debug_toolbar URLs if activated if 'debug_toolbar' in settings.INSTALLED_APPS: