Merging benjaomings work on team guides.

This commit is contained in:
Víðir Valberg Guðmundsson 2019-03-12 11:13:13 +01:00
parent c51771be6b
commit 0a3c71337e
7 changed files with 42 additions and 25 deletions

View file

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-11-25 21:32
from __future__ import unicode_literals
# Generated by Django 2.1.5 on 2019-03-12 10:00
from django.db import migrations, models
@ -8,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('teams', '0018_auto_20171122_2204'),
('teams', '0049_auto_20180815_1119'),
]
operations = [

View file

@ -15,23 +15,23 @@ logger = logging.getLogger("bornhack.%s" % __name__)
TEAM_GUIDE_TEMPLATE="""
# Preparations
## Preparations
...
# Camp setup
## Camp setup
...
# During camp
## During camp
...
# Takedown
## Takedown
...
# Notes for next year
## Notes for next year
1. Remember to take notes
1. ...

View file

@ -1,25 +1,37 @@
{% extends 'base.html' %}
{% extends 'team_base.html' %}
{% load commonmark %}
{% block title %}
Guide for: {{ team.name }} | {{ block.super }}
{% endblock %}
{% block content %}
{% block team_content %}
<h1 class="page-header">Guide / Howto for {{ team.name }}</h1>
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h4 class="pull-left">
Guide / Howto for {{ team.name }}
</h4>
<a href="{% url 'teams:guide_print' camp_slug=camp.slug team_slug=team.slug %}"
class="btn btn-default pull-right"
target="_blank">
Print
</a>
</div>
<div class="panel-body">
<p>
{% if request.user in team.responsible.all %}
<a href="{% url 'teams:manage' camp_slug=camp.slug team_slug=team.slug %}" class="btn btn-warning">Edit</a>
{% endif %}
</p>
<p>
<a href="{% url 'teams:guide_print' camp_slug=camp.slug team_slug=team.slug %}" class="btn btn-default" target="_blank">Print</a>
{% if request.user in team.responsible.all %}
<a href="{% url 'teams:manage' camp_slug=camp.slug team_slug=team.slug %}" class="btn btn-warning">Edit</a>
{% endif %}
</p>
<div class="team-guide-markdown">
{{ team.guide|unsafecommonmark }}
<div class="team-guide-markdown">
{{ team.guide|untrustedcommonmark }}
</div>
</div>
</div>
{% endblock %}

View file

@ -1,10 +1,11 @@
<html>{% load commonmark %}
{% load commonmark %}
<html>
<head>
<title>{{ team.name }}</title>
</head>
<body onload="window.print()">
{{ team.guide|unsafecommonmark }}
{{ team.guide|untrustedcommonmark }}
</body>
</html>

View file

@ -40,6 +40,11 @@ from teams.views.shifts import (
UserShifts,
)
from teams.views.guide import (
TeamGuideView,
TeamGuidePrintView
)
app_name = 'teams'
urlpatterns = [

View file

@ -46,7 +46,7 @@ class TeamManageView(CampViewMixin, EnsureTeamResponsibleMixin, UpdateView):
fields = ['description', 'needs_members', 'public_irc_channel_name',
'public_irc_channel_bot', 'public_irc_channel_managed',
'private_irc_channel_name', 'private_irc_channel_bot',
'private_irc_channel_managed']
'private_irc_channel_managed', 'guide']
slug_url_kwarg = 'team_slug'
def get_success_url(self):

View file

@ -3,7 +3,7 @@ from django.views.generic import ListView, DetailView
from camps.mixins import CampViewMixin
from .models import Team
from ..models import Team
class TeamGuideView(LoginRequiredMixin, CampViewMixin, DetailView):
@ -11,6 +11,7 @@ class TeamGuideView(LoginRequiredMixin, CampViewMixin, DetailView):
context_object_name = 'team'
model = Team
slug_url_kwarg = 'team_slug'
active_menu = 'guide'
def get_queryset(self):
qs = CampViewMixin.get_queryset(self)