From fa1e7cf9320d8124efe70a9f4ab093d314acf178 Mon Sep 17 00:00:00 2001 From: Prathamesh Date: Wed, 27 Dec 2023 14:44:20 +0530 Subject: Change UI --- .gitignore | 1 + website/cgen/generator.py | 2 +- website/cgen/models.py | 9 +- website/cgen/templates/base.html | 157 ++++++++++++++++++++----------- website/cgen/templates/download.html | 53 ++++++----- website/cgen/templates/index.html | 90 ++++++++++++++++++ website/cgen/templates/verification.html | 55 ++++++----- website/cgen/verification.py | 3 +- website/cgen/views.py | 10 +- website/website/settings.py | 5 + 10 files changed, 274 insertions(+), 111 deletions(-) mode change 100755 => 100644 website/cgen/templates/base.html create mode 100644 website/cgen/templates/index.html diff --git a/.gitignore b/.gitignore index a0c9ca2..c1036fe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__ local.py *.pyc *.swp +certificates diff --git a/website/cgen/generator.py b/website/cgen/generator.py index cd55f7f..b894c93 100644 --- a/website/cgen/generator.py +++ b/website/cgen/generator.py @@ -36,7 +36,7 @@ def get_details(certificate_id, email): info['serial_key'] = key info['qr_code'] = f'{DOMAIN}/certificates/verify/{key}/' certificate_details['info'] = info - path = f'{settings.BASE_DIR}/{certificate.id}' + path = f'{settings.BASE_DIR}/certificates/{certificate.id}' certificate_details['path'] = path if not os.path.exists(f"path/{{Makefile}}"): shutil.copy2(f'{settings.BASE_DIR}/Makefile', path) diff --git a/website/cgen/models.py b/website/cgen/models.py index 30bb762..e367ae3 100644 --- a/website/cgen/models.py +++ b/website/cgen/models.py @@ -1,6 +1,7 @@ from django.db import models, IntegrityError from django.utils import timezone from django.contrib.auth.models import User +from django.conf import settings import os import hashlib @@ -11,13 +12,13 @@ types = ( ) # Create your models here. - - def get_file_dir(instance, filename): - return os.sep.join((str(instance.id), filename)) + if not os.path.exists(settings.CERTIFICATES_PATH): + os.mkdir(settings.CERTIFICATES_PATH) + return os.sep.join(('certificates', str(instance.id), filename)) def get_certificate_dir(instance, filename): - return os.sep.join((str(instance.participant.certificate.id), str(instance.id), filename)) + return os.sep.join(('certificates', str(instance.participant.certificate.id), str(instance.id), filename)) class Event(models.Model): """ diff --git a/website/cgen/templates/base.html b/website/cgen/templates/base.html old mode 100755 new mode 100644 index 69190e8..4e6bd11 --- a/website/cgen/templates/base.html +++ b/website/cgen/templates/base.html @@ -1,57 +1,104 @@ - - - - - - {% block title %} - Certificates - {% endblock %} - - {% block css %} - - {% endblock %} - {% block js %} - - - {% endblock %} - {% block javascript %} - + + + + + + + + + + + + + {% block title %} + Certificates {% endblock %} - </head> - <body> - <div class="container-full"> -<nav class="navbar navbar-dark bg-dark"> - <a class="navbar-brand" href="{% url 'events' %}">Events</a> -</nav> - <div class="row"> - - <div class="col-lg-12 text-center v-center"> - {% block header%} - - {% endblock %} - {% block content %} - {% endblock %} - </div> - - </div> <!-- /row --> - <hr> - <br> - <div id="footer-wrapper" class="container"> - <div id="footer-inner" class="col-lg-12 col-md-12 col-sm-12"> - <div class="pull-left"> - <!--[if lte IE 8]><span style="filter: FlipH; -ms-filter: "FlipH"; display: inline-block;"><![endif]--> - <span style="-moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); display: inline-block;"> - <!--<a href="http://www.gnu.org/copyleft/" target="_blank">©</a>--> - </span> - <!--[if lte IE 8]></span><![endif]--> - <!--2013 <a href="http://fossee.in" target="_blank">fossee.in</a>--> - </div> - <div class="pull-right"> - Developed at IIT Bombay - </div> - </div> <!-- /#footer-inner --> - </div> <!-- /#footer-wrapper --> - </div> <!-- /container full --> - </body> -</html> + + + + {% block css %} + + {% endblock %} + {% block js %} + + + + + {% endblock %} + {% block javascript %} + + {% endblock %} + + {% block head %} + {% endblock %} + + + + +
+ + +
+ +
+
+
+
+

{% block header %} {% endblock %}

+

{% block header_content %} {% endblock %}

+

+
+
+
+ +
+
+ {% block content %} + {% endblock %} +
+
+ + +
+ + + + + + + + diff --git a/website/cgen/templates/download.html b/website/cgen/templates/download.html index 11f3c2a..afa8117 100644 --- a/website/cgen/templates/download.html +++ b/website/cgen/templates/download.html @@ -1,30 +1,39 @@ {% extends 'base.html' %} {% block header%} -

{{ certificate.event.name }} Certificates

+ {{ certificate.event.name }} Certificates {% endblock %} {% block content %} -