.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.8 on 2021-12-14 19:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('generic', '0019_cidusergroup_archive'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ciduser',
|
||||
name='supervisor_email',
|
||||
field=models.EmailField(blank=True, max_length=254),
|
||||
),
|
||||
]
|
||||
@@ -11,6 +11,8 @@ from django.conf import settings
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
from django.core.mail import send_mail
|
||||
|
||||
|
||||
class Plane(models.Model):
|
||||
plane = models.CharField(max_length=200)
|
||||
@@ -216,6 +218,20 @@ class CidUser(models.Model):
|
||||
def check_passcode(self, passcode) -> bool:
|
||||
return self.passcode == passcode
|
||||
|
||||
def email_details(self):
|
||||
msg = f"""
|
||||
Candidate details for upcomming event {self.group}
|
||||
---------
|
||||
CID: {self.cid}
|
||||
Passcode: {self.passcode}
|
||||
|
||||
|
||||
|
||||
Please note this inbox is not monitored. Direct all enquiries to ...
|
||||
"""
|
||||
|
||||
send_mail("Candidate Details", msg, "test@xkjq.uk", [self.email])
|
||||
|
||||
class CidUserExam(models.Model):
|
||||
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||
object_id = models.PositiveIntegerField()
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
{% extends 'generic/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% for group in groups %}
|
||||
<p>Group: {{author.name}} [Email candidate details]</p>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}
|
||||
CIDs
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
{% block navigation %}
|
||||
CIDs:
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'generic:manage_cids' %}">Cids</a> /
|
||||
<a href="{% url 'generic:group_view' %}">Groups</a> /
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -27,5 +27,6 @@ urlpatterns = [
|
||||
name="examination-autocomplete",
|
||||
),
|
||||
path("cids/manage/", views.CidUserView.as_view(), name="manage_cids"),
|
||||
path("cids/group/<int:pk>", views.group_view, name="group_view"),
|
||||
path("cids/create", views.manage_cid_users, name="manage_cid_users"),
|
||||
]
|
||||
|
||||
@@ -988,6 +988,16 @@ class CidUserView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
context["cid_user_groups"] = cid_user_groups
|
||||
return context
|
||||
|
||||
@login_required
|
||||
@user_is_cid_user_manager
|
||||
def group_view(request):
|
||||
groups = CidUserGroup.objects.filter(archive=False)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"generic/group_view.html",
|
||||
{"groups": groups},
|
||||
)
|
||||
|
||||
@login_required
|
||||
@user_is_cid_user_manager
|
||||
|
||||
Reference in New Issue
Block a user