Commit 50e6d9e2 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🍪

organiser dashboard mockups

parent af1e9e4a
Pipeline #1295 failed with stages
in 2 minutes and 48 seconds
{% extends "base.html" %}
{% block content %}
<div class="row">
<div class="col-sm-8">
<div class="card mb-4">
<div class="card-body">
<h2 class="card-heading">Tracks</h2>
<table class="table">
<th class="text-center">Entrants</th>
<th class="text-center">Students</th>
{% for track in tracks %}
<th><a href="{% url 'track_detail' %}">{{}}</a></th>
<td class="text-center">{{track.submission__count}}</td>
<td class="text-center">TODO</td>
{% endfor %}
<div class="card-footer text-right">
<a href="#" class="btn btn-primary btn-sm"><i class="fas fa-plus-circle"></i> Create track</a>
<div class="col-sm-4">
<div class="card">
<div class="card-body">
<h2 class="card-heading">Alerts</h2>
<ul class="list-group list-group-flush">
{% for a in alerts %}
<li class="list-group-item">
<div class="d-flex w-100 justify-content-between">
<h3 class="mb-1">{{a.title}}</h3>
<p class="mb-1">{{a.lead}}</p>
{% endfor %}
{% endblock %}
{% extends "base.html" %}
{% load account bootstrap4 %}
{% block head_title %}{{track}}{% endblock %}
{% block content %}
{% if is None %}
<h1>Create New Track</h1>
{% else %}
<h1>Update '{{form.instance}}'</h1>
{% endif %}
<form method="post" action="#">
{% csrf_token %}
{% bootstrap_form form %}
<input type="hidden" name="track" value="{{}}" />
{% if is None %}
<input type="submit" class="btn btn-primary" value="Create" />
{% else %}
<input type="submit" class="btn btn-primary" value="Update" />
{% endif %}
{% if is None %}
<a href="{{ track.get_absolute_url }}" class="btn btn-text">cancel</a>
{% else %}
<a href="{{ form.instance.get_absolute_url }}" class="btn btn-text">cancel</a>
{% endif %}
{% endblock %}
from django.conf.urls import url, include
from . import views
from . import views, views_organiser
urlpatterns = [
url(r'^$', views.TrackList.as_view(), name="competitions"),
url(r'^odb$', views_organiser.Dashboard.as_view(), name="org_dashboard"),
url(r'^db$', views.SubmitterDashboard.as_view(), name="dashboard"),
url(r'^tu/(?P<pk>\w+)$', views_organiser.TrackUpdate.as_view(), name="track_update"),
url(r'^v/(?P<slug>\w+)$', views.CompetitionDetail.as_view(), name="competition_detail"),
url(r'^t/(?P<pk>\w+)$', views.TrackDetail.as_view(), name="track_detail"),
url(r'^t/(?P<track>\w+)/enter$', views.SubmissionCreate.as_view(), name="submission_create"),
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from django.views.generic.edit import UpdateView
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.db.models import Count
from .models import Competition, Track, Submission, SubmissionUpload
class Dashboard(LoginRequiredMixin, TemplateView):
template_name = "fg_competitions/organiser/dashboard.html"
def get_context_data(self, **kwargs):
context = super(TemplateView, self).get_context_data(**kwargs)
context['tracks'] = Track.objects.filter(owner=self.request.user).annotate(Count('submission'))
alerts = []
for x in range(0, 5):
"title": "Heading",
"lead": "testing",
"published": "4 hours ago"
context['alerts'] = alerts
return context
class TrackUpdate(UserPassesTestMixin, UpdateView):
model = Track
raise_exception = True
fields = ['name', 'description', 'allow_submit', 'allow_update']
def test_func(self):
"""check the person attempting to edit the track is the owner"""
obj = self.get_object()
return ==
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment