From 33d434e5b8fc7e8b23bef78bb9e3f0739ee9e222 Mon Sep 17 00:00:00 2001 From: Prathamesh Date: Mon, 8 Jan 2024 12:19:57 +0530 Subject: Make delete option available for the admin --- website/cgen/models.py | 8 ++++---- website/cgen/templates/base.html | 4 ++-- website/cgen/templates/index.html | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/website/cgen/models.py b/website/cgen/models.py index e367ae3..0387a29 100644 --- a/website/cgen/models.py +++ b/website/cgen/models.py @@ -45,7 +45,7 @@ class Event(models.Model): is_published = models.BooleanField(default=False) # One who creates the event (organiser) - creator = models.ForeignKey(User, null=True, on_delete=models.PROTECT) + creator = models.ForeignKey(User, null=True, on_delete=models.CASCADE) def __str__(self): @@ -58,7 +58,7 @@ class Certificate(models.Model): """ # Event to which the certificate belongs - event = models.ForeignKey(Event, on_delete=models.PROTECT) + event = models.ForeignKey(Event, on_delete=models.CASCADE) # Type of certificate description = models.TextField() @@ -87,7 +87,7 @@ class Participant(models.Model): email = models.EmailField(max_length=1000) - certificate = models.ForeignKey('Certificate', on_delete=models.PROTECT) + certificate = models.ForeignKey('Certificate', on_delete=models.CASCADE) details = models.TextField() @@ -107,7 +107,7 @@ class CertificateManager(models.Model): null=True, blank=True, default=None, ) - participant = models.ForeignKey(Participant, on_delete=models.PROTECT) + participant = models.ForeignKey(Participant, on_delete=models.CASCADE) is_created = models.BooleanField(default=False) diff --git a/website/cgen/templates/base.html b/website/cgen/templates/base.html index edb4e75..4e6bd11 100644 --- a/website/cgen/templates/base.html +++ b/website/cgen/templates/base.html @@ -67,8 +67,8 @@
-
-
+
+

{% block header %} {% endblock %}

{% block header_content %} {% endblock %}

diff --git a/website/cgen/templates/index.html b/website/cgen/templates/index.html index 134f021..5ace6a7 100644 --- a/website/cgen/templates/index.html +++ b/website/cgen/templates/index.html @@ -74,10 +74,10 @@

{{ event.name }}

{% for certificate in event.certificate_set.all %}
-

{{ certificate.description }} +

Certificate {{ certificate.description }}

-- cgit