mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 17:32:16 +00:00
Add training database index
This commit is contained in:
17
training/templates/training/index.html
Normal file
17
training/templates/training/index.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Training Database{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 col-md-4">
|
||||||
|
<h2>Training Database</h2>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 col-md-8 align-right">
|
||||||
|
{# @todo: Add nav buttons and other useful things in here #}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>My Training</h3>
|
||||||
|
{% include "training/profile_detail_table.html" %}
|
||||||
|
{% endblock %}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{% load training_extras %}
|
{% load training_extras %}
|
||||||
|
|
||||||
<h3>{{ category }}</h3>
|
<h4>{{ category }}</h4>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ from django.conf.urls import patterns, url
|
|||||||
from training import views
|
from training import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
url(r'^$', views.SelfUserTrainingRecordView.as_view()),
|
||||||
url(r'user/(?P<pk>\d+)/$', views.UserTrainingRecordView.as_view())
|
url(r'user/(?P<pk>\d+)/$', views.UserTrainingRecordView.as_view())
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,3 +17,13 @@ class UserTrainingRecordView(generic.DetailView):
|
|||||||
context = super(UserTrainingRecordView, self).get_context_data(**kwargs)
|
context = super(UserTrainingRecordView, self).get_context_data(**kwargs)
|
||||||
context['categories'] = models.TrainingCategory.objects.all()
|
context['categories'] = models.TrainingCategory.objects.all()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
class SelfUserTrainingRecordView(UserTrainingRecordView):
|
||||||
|
template_name = 'training/index.html'
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
pk = self.request.user.id
|
||||||
|
self.kwargs['pk'] = pk
|
||||||
|
|
||||||
|
return self.model.objects.filter(pk=pk)
|
||||||
|
|||||||
Reference in New Issue
Block a user