mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
Session log form work
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
<div class="list-group list-group-flush">
|
||||
<a class="list-group-item list-group-item-action" href="{% url 'trainee_detail' %}"><span class="fas fa-file-signature align-middle"></span><span class="align-middle"> My Training Record</span></a>
|
||||
<a class="list-group-item list-group-item-action" href="{% url 'item_list' %}"><span class="fas fa-eye align-middle"></span><span class="align-middle"> View Training Items</span></a>
|
||||
<a class="list-group-item list-group-item-action" href=""><span class="fas fa-plus align-middle"></span><span class="align-middle"> Log Training Session</span></a>
|
||||
<a class="list-group-item list-group-item-action" href="{% url 'session_log' %}"><span class="fas fa-plus align-middle"></span><span class="align-middle"> Log Training Session</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
4
training/forms.py
Normal file
4
training/forms.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from django import forms
|
||||
|
||||
class SessionLogForm(forms.Form):
|
||||
pass
|
||||
@@ -1,12 +1,34 @@
|
||||
{% extends 'base_rigs.html' %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block css %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block preload_js %}
|
||||
{{ block.super }}
|
||||
<script src="{% static 'js/selects.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ block.super }}
|
||||
<script src="{% static 'js/autocompleter.js' %}"></script>
|
||||
<script src="{% static 'js/interaction.js' %}"></script>
|
||||
<script src="{% static 'js/tooltip.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<h1>Log New Training Session</h1>
|
||||
<div class="form-group">
|
||||
<label for="selectpicker">Select Attendees</label>
|
||||
<select name="attendees" id="attendees_id" class="form-control selectpicker" data-live-search="true">
|
||||
</select>
|
||||
</div>
|
||||
<div class="col">
|
||||
<form class="form">
|
||||
<div class="form-group">
|
||||
<label for="selectpicker">Select Attendees</label>
|
||||
<select name="attendees" id="attendees_id" class="form-control selectpicker custom-select" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials">
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -12,4 +12,5 @@ urlpatterns = [
|
||||
path('trainee/<int:pk>/',
|
||||
permission_required_with_403('RIGS.view_profile')(views.TraineeDetail.as_view()),
|
||||
name='trainee_detail'),
|
||||
path('session/', views.SessionLog.as_view(), name='session_log'),
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
from django.views import generic
|
||||
from training import models
|
||||
from training import models, forms
|
||||
|
||||
from users import views
|
||||
|
||||
@@ -29,4 +29,13 @@ class TraineeDetail(views.ProfileDetail):
|
||||
for i in [x for x,_ in choices]:
|
||||
context[str(i)] = self.object.get_records_of_depth(i)
|
||||
return context
|
||||
|
||||
|
||||
|
||||
class SessionLog(generic.FormView):
|
||||
template_name = "session_log_form.html"
|
||||
form_class = forms.SessionLogForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(SessionLog, self).get_context_data(**kwargs)
|
||||
context["page_title"] = "Log New Training Session"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user