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 %}
-
-
-
-
-
-
-
- {% block header%}
-
- {% endblock %}
- {% block content %}
- {% endblock %}
-
-
-
-
-
-
-
-
-
+
+
+
+ {% 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 %}
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
The requested certificate is unavailable for your email address. Please enter proper email and retry.
-
-
+
+
+
-
-
-
+
+
+
{% endblock %}
{% block javascript %}
@@ -34,7 +43,7 @@
email = ""
error = "{{ error }}"
if(error == "True"){
- $("#invalidModal").modal();
+ $("#invalidModal").show();
}
if(value == "paper"){
$('#A').prop('checked', true)
@@ -43,7 +52,7 @@
$('#email').val(email);
notreg = "{{ notregistered }}";
if(notreg == "1"){
- $("#invalidModal").modal();
+ $("#invalidModal").show();
}
$("[name=type]").change(function(){
$("#paper").remove();
diff --git a/website/cgen/templates/index.html b/website/cgen/templates/index.html
new file mode 100644
index 0000000..5dfdbf7
--- /dev/null
+++ b/website/cgen/templates/index.html
@@ -0,0 +1,90 @@
+{% extends 'base.html' %}
+ {% block head %}
+
+
+ {% endblock %}
+
+{% block header %}
+ Certificates available for download.
+{% endblock %}
+
+{% block header_content %}
+ Certificates for the following events and courses are available.
+{% endblock %}
+
+{% block content %}
+
+ {% for event in events %}
+
+
+
+
+
+
{{ event.name }}
+ {% for certificate in event.certificate_set.all %}
+
+
{{ certificate.description }}
+
+
+
9 Downloads
+ {% endfor %}
+
+
+
+ {% endfor %}
+
+{% endblock %}
diff --git a/website/cgen/templates/verification.html b/website/cgen/templates/verification.html
index df33779..ad834a1 100755
--- a/website/cgen/templates/verification.html
+++ b/website/cgen/templates/verification.html
@@ -1,54 +1,57 @@
{% extends 'base.html' %}
{% block header%}
-
Certificate Verification
+ Certificate Verification
{% endblock %}
{% block content %}
-
-
-
-
-
+
+
+
+
+
+
Sorry ! The serial number you entered seems to be invalid. Please try again !
-
-
+
+
+
+
-
Enter the alphanumeric characters below the QR code
OR
Enter the serial number you received while scanning the QR code on certificate
-
-
+
+
Enter the alphanumeric characters below the QR code
OR
Enter the serial number you received while scanning the QR code on certificate
+