mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-27 02:12:18 +00:00
Whee broken HEAD
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
from django.views import generic
|
||||
from PyRIGS.views import OEmbedView, is_ajax
|
||||
from training import models, forms
|
||||
|
||||
from users import views
|
||||
@@ -38,4 +40,29 @@ class SessionLog(generic.FormView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(SessionLog, self).get_context_data(**kwargs)
|
||||
context["page_title"] = "Log New Training Session"
|
||||
|
||||
context["depths"] = models.TrainingItemQualification.CHOICES
|
||||
return context
|
||||
|
||||
|
||||
class AddQualification(generic.CreateView):
|
||||
template_name = "edit_training_record.html"
|
||||
model = models.TrainingItemQualification
|
||||
form_class = forms.QualificationForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(AddQualification, self).get_context_data(**kwargs)
|
||||
# context["page_title"] = "Edit {}'s Training Record".format(self.object)
|
||||
context["depths"] = models.TrainingItemQualification.CHOICES
|
||||
if is_ajax(self.request):
|
||||
context['override'] = "base_ajax.html"
|
||||
else:
|
||||
context['override'] = 'base_rigs.html' # TODO
|
||||
return context
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse_lazy('trainee_detail')
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(AddQualification, self).get_form_kwargs()
|
||||
kwargs['pk'] = self.kwargs['pk']
|
||||
return kwargs
|
||||
|
||||
Reference in New Issue
Block a user