From f88af509ccc534f476bdcd243824fc612e99fb61 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 5 Mar 2021 11:52:56 +0100 Subject: [PATCH] shared sessions now work --- rowers/models.py | 2 +- rowers/templates/plannedsessioncreate.html | 24 ++- .../templates/plannedsessionteamcreate.html | 37 +++- .../plannedsessiontemplatecreate.html | 194 ++++++++++++++++++ rowers/templates/templatelibrary.html | 72 ++++++- rowers/urls.py | 6 + rowers/views/planviews.py | 146 ++++++++++++- 7 files changed, 448 insertions(+), 33 deletions(-) create mode 100644 rowers/templates/plannedsessiontemplatecreate.html diff --git a/rowers/models.py b/rowers/models.py index 0d5a45ad..1ff7cb8d 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2324,7 +2324,7 @@ class PlannedSession(models.Model): interval_string = models.TextField(max_length=1000,default=None,blank=True,null=True, verbose_name='Interval String (optional)') - tags = TaggableManager() + tags = TaggableManager(blank=True) def __str__(self): diff --git a/rowers/templates/plannedsessioncreate.html b/rowers/templates/plannedsessioncreate.html index 1258113a..09b9d893 100644 --- a/rowers/templates/plannedsessioncreate.html +++ b/rowers/templates/plannedsessioncreate.html @@ -101,9 +101,6 @@
  • Session Library

    -

    - Click on session name to clone to current period -

    {% if alltags %}

    Click on a tag to filter: @@ -120,7 +117,7 @@ Name Value -   + Copy to Calendar Edit Delete @@ -130,21 +127,28 @@ {% if ps.name != '' %} - {{ ps.name }} + {{ ps.name }} {% else %} - Unnamed Session + Unnamed Session {% endif %} - {{ ps.sessionvalue }} - {{ ps.sessionunit }} + {{ ps.sessionvalue }} {{ ps.sessionunit }} + + + + + + {% if ps.manager == request.user %} + {% else %} + + {% endif %} {% endfor %} diff --git a/rowers/templates/plannedsessionteamcreate.html b/rowers/templates/plannedsessionteamcreate.html index 1089acfc..de235cfe 100644 --- a/rowers/templates/plannedsessionteamcreate.html +++ b/rowers/templates/plannedsessionteamcreate.html @@ -107,15 +107,23 @@ {% endif %}

  • Session Library

    -

    - Click on session name to clone to current period -

    + {% if alltags %} +

    + Click on a tag to filter: + {% for tag in alltags %} + {{ tag }} + {% endfor %} +

    +

    + Clear tags +

    + {% endif %} - + @@ -125,21 +133,28 @@ - - + + + {% if ps.manager == request.user %} + {% else %} + + {% endif %} {% endfor %} diff --git a/rowers/templates/plannedsessiontemplatecreate.html b/rowers/templates/plannedsessiontemplatecreate.html new file mode 100644 index 00000000..3384a909 --- /dev/null +++ b/rowers/templates/plannedsessiontemplatecreate.html @@ -0,0 +1,194 @@ +{% extends "newbase.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}Create Library Session{% endblock %} + +{% block main %} +

    Edit Session Template

    + + + +
    Name Value Copy to Calendar Edit Delete
    {% if ps.name != '' %} - {{ ps.name }} + {{ ps.name }} {% else %} - Unnamed Session + Unnamed Session {% endif %} {{ ps.sessionvalue }} {{ ps.sessionunit }} {{ ps.sessionvalue }} {{ ps.sessionunit }} + + + + - +
    + {{ form.as_table }} +
    +

    + {% csrf_token %} +
    + +
    + + + +
  • +
  • +

    Library

    +

    + Click on session name to clone to current period +

    + + + + + + + + + + + + {% for ps in sessiontemplates %} + + + + + + + + {% endfor %} + +
    NameValue EditDelete
    + {% if ps.name != '' %} + {{ ps.name }} + {% else %} + Unnamed Session + {% endif %} + {{ ps.sessionvalue }} {{ ps.sessionunit }} + + + +
    +
  • + + +{% endblock %} + +{% block sidebar %} +{% include 'menu_plan.html' %} +{% endblock %} + + +{% block scripts %} + + + +{% endblock %} diff --git a/rowers/templates/templatelibrary.html b/rowers/templates/templatelibrary.html index 3d3e702c..55754986 100644 --- a/rowers/templates/templatelibrary.html +++ b/rowers/templates/templatelibrary.html @@ -8,11 +8,26 @@

    Planned Session Library

    +{% if alltags %} +

    + Click on a tag to filter: + {% for tag in alltags %} + {{ tag }} + {% endfor %} +

    +

    + Clear tags +

    +{% endif %} + +