.
This commit is contained in:
+13
-5
@@ -9,9 +9,7 @@ from django.forms import (
|
||||
)
|
||||
from django.forms import inlineformset_factory
|
||||
|
||||
from generic.models import (
|
||||
CidUser, Examination, QuestionNote
|
||||
)
|
||||
from generic.models import CidUser, Examination, QuestionNote
|
||||
|
||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||
from django.forms.widgets import RadioSelect, TextInput, Textarea
|
||||
@@ -24,16 +22,18 @@ from django.shortcuts import render, get_object_or_404, redirect
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
|
||||
class ExaminationForm(ModelForm):
|
||||
class Meta:
|
||||
model = Examination
|
||||
fields = ["examination"]
|
||||
|
||||
|
||||
class QuestionNoteForm(ModelForm):
|
||||
class Meta:
|
||||
model = QuestionNote
|
||||
fields = ["content_type", "object_id", "author", "note_type", "note"]
|
||||
widgets = {'content_type': HiddenInput(), 'object_id': HiddenInput()}
|
||||
widgets = {"content_type": HiddenInput(), "object_id": HiddenInput()}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
question_type = kwargs.pop("question_type")
|
||||
@@ -67,7 +67,15 @@ class QuestionNoteForm(ModelForm):
|
||||
# self.fields["content_type"].initial = content_type
|
||||
# self.fields["object_id"].initial = pk
|
||||
|
||||
|
||||
class CidUserForm(ModelForm):
|
||||
class Meta:
|
||||
model = CidUser
|
||||
fields = ["cid", "passcode", "active", "internal_candidate", "name", "email", "supervisor_email"]
|
||||
fields = [
|
||||
"passcode",
|
||||
"active",
|
||||
"internal_candidate",
|
||||
"name",
|
||||
"email",
|
||||
"supervisor_email",
|
||||
]
|
||||
|
||||
@@ -247,6 +247,9 @@ class CidUser(models.Model):
|
||||
def __str__(self) -> str:
|
||||
return str(self.cid)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('generic:manage_cids')
|
||||
|
||||
def check_passcode(self, passcode) -> bool:
|
||||
return self.passcode == passcode
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "atlas/base.html" %}
|
||||
{% extends "generic/base.html" %}
|
||||
<!-- {% load static from static %} -->
|
||||
|
||||
{% block css %}
|
||||
@@ -13,8 +13,8 @@
|
||||
<!-- {{ form.media }} -->
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Edit CID User</h2>
|
||||
Use this form to create or edit a CID user.
|
||||
<h2>Edit CID User / {{ciduser.cid}}</h2>
|
||||
Use this form to edit a CID user.
|
||||
<form action="" method="post" enctype="multipart/form-data" id="condition-form">
|
||||
{% csrf_token %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user