From a920a9fa611fd40eb343cc71317fc49e4be98882 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 15 Mar 2021 10:49:17 +0000 Subject: [PATCH] trying to get new templates to work --- .gitignore | 1 + back_latienda/settings/base.py | 10 +- products/views.py | 2 +- static/.gitignore | 2 + templates/purchase_notification_v1.html | 176 ++++++++++++++++++ ...ion.html => purchase_notification_v2.html} | 54 +++--- 6 files changed, 214 insertions(+), 31 deletions(-) create mode 100644 static/.gitignore create mode 100755 templates/purchase_notification_v1.html rename templates/{purchase_notification.html => purchase_notification_v2.html} (99%) diff --git a/.gitignore b/.gitignore index aa7ea9b..8c73834 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ # environment variables .env + # virtual env venv/ diff --git a/back_latienda/settings/base.py b/back_latienda/settings/base.py index 4996fc6..af2f1b1 100644 --- a/back_latienda/settings/base.py +++ b/back_latienda/settings/base.py @@ -85,7 +85,7 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, '../templates'),], - 'APP_DIRS': True, + # 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', @@ -93,6 +93,12 @@ TEMPLATES = [ 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], + 'loaders': [ + ( + 'django.template.loaders.filesystem.Loader', + [os.path.join(BASE_DIR, '../templates')], + ), + ], }, }, ] @@ -153,7 +159,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_URL = '/static/' - +STATIC_ROOT = 'static' TAXONOMY_FILE = 'shop-taxonomy.es-ES.txt' diff --git a/products/views.py b/products/views.py index c756044..ff800cd 100644 --- a/products/views.py +++ b/products/views.py @@ -292,7 +292,7 @@ def purchase_email(request): return Response({"error": "Related compay has no contact email address"}, status=status.HTTP_406_NOT_ACCEPTABLE) try: # send email to company - company_message = render_to_string('purchase_notification.html', { + company_message = render_to_string('purchase_notification_v2.html', { 'company': company, 'user': request.user, 'product': product, diff --git a/static/.gitignore b/static/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/static/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/templates/purchase_notification_v1.html b/templates/purchase_notification_v1.html new file mode 100755 index 0000000..6dfee51 --- /dev/null +++ b/templates/purchase_notification_v1.html @@ -0,0 +1,176 @@ + + + + + + + + + + + + Interés en copra de producto + + + +
+
+ + + +

+ Interés en compra + de producto +

+
+
+
+ + + + Enlace al producto + Nombre del producto: {{product.name}} + {{product.sku}} + {{product.price}} +
+
+

Datos cliente

+
+
Nombre:
+
{{user.full_name}}
+
Email:
+
{{user.email}}
+
Teléfono:
+
{{telephone}}
+
Comentarios:
+
{{comment}}
+
+
+
+
+
+ 2021 La Tienda.Coop +
+
+ + + diff --git a/templates/purchase_notification.html b/templates/purchase_notification_v2.html similarity index 99% rename from templates/purchase_notification.html rename to templates/purchase_notification_v2.html index 522c0e5..69ff976 100755 --- a/templates/purchase_notification.html +++ b/templates/purchase_notification_v2.html @@ -6,9 +6,6 @@ > - - -