tags on session create
This commit is contained in:
@@ -12,6 +12,8 @@ billiard==3.6.0.0
|
||||
bleach==3.1.0
|
||||
bokeh==2.2.3
|
||||
boto==2.49.0
|
||||
boto3==1.17.12
|
||||
botocore==1.20.12
|
||||
bottle==0.12.18
|
||||
braintree==3.55.0
|
||||
cairocffi==1.0.2
|
||||
@@ -55,11 +57,12 @@ django-rest-framework==0.1.0
|
||||
django-rest-swagger==2.2.0
|
||||
django-rq==1.3.1
|
||||
django-rq-dashboard==0.3.3
|
||||
django-ses==0.8.10
|
||||
django-ses==1.0.3
|
||||
django-shell-plus==1.1.7
|
||||
django-social-share==1.3.2
|
||||
django-suit==0.2.28
|
||||
django-suit-rq==1.0.1
|
||||
django-taggit==1.3.0
|
||||
django-tz-detect==0.2.9
|
||||
djangorestframework==3.9.2
|
||||
docopt==0.6.2
|
||||
@@ -100,6 +103,7 @@ itypes==1.1.0
|
||||
jedi==0.13.3
|
||||
jeepney==0.4
|
||||
Jinja2==2.10
|
||||
jmespath==0.10.0
|
||||
json5==0.8.5
|
||||
jsonschema==3.0.1
|
||||
jupyter==1.0.0
|
||||
@@ -180,10 +184,11 @@ ratelim==0.1.6
|
||||
redis==3.5.3
|
||||
requests==2.23.0
|
||||
requests-oauthlib==1.2.0
|
||||
rowingdata==3.1.3
|
||||
rowingdata==3.1.4
|
||||
rowingphysics==0.5.0
|
||||
rq==0.13.0
|
||||
rules==2.1
|
||||
s3transfer==0.3.4
|
||||
scipy==1.5.4
|
||||
SecretStorage==3.1.1
|
||||
Send2Trash==1.5.0
|
||||
|
||||
@@ -44,6 +44,7 @@ import pandas as pd
|
||||
from dateutil import parser
|
||||
import datetime
|
||||
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
#from rules.contrib.models import RulesModel
|
||||
|
||||
@@ -2291,6 +2292,8 @@ class PlannedSession(models.Model):
|
||||
interval_string = models.TextField(max_length=1000,default=None,blank=True,null=True,
|
||||
verbose_name='Interval String (optional)')
|
||||
|
||||
tags = TaggableManager()
|
||||
|
||||
def __str__(self):
|
||||
|
||||
name = self.name
|
||||
@@ -2611,7 +2614,8 @@ class PlannedSessionTemplateForm(ModelForm):
|
||||
'course',
|
||||
'comment',
|
||||
'interval_string',
|
||||
'fitfile'
|
||||
'fitfile',
|
||||
'tags',
|
||||
]
|
||||
|
||||
dateTimeOptions = {
|
||||
|
||||
@@ -102,6 +102,17 @@
|
||||
<p>
|
||||
Click on session name to clone to current period
|
||||
</p>
|
||||
{% if alltags %}
|
||||
<p>
|
||||
Click on a tag to filter:
|
||||
{% for tag in alltags %}
|
||||
<a href="/rowers/sessions/create/?when={{ timeperiod }}&tag={{ tag }}">{{ tag }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<a href="/rowers/sessions/create/?when={{ timeperiod }}">Clear tags</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<table class="listtable shortpadded" width="80%">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -7,6 +7,8 @@ from rowers.views.statements import *
|
||||
from rowingdata import trainingparser
|
||||
import json
|
||||
|
||||
from taggit.models import Tag
|
||||
|
||||
@login_required
|
||||
@permission_required('plannedsession.view_session',fn=get_session_by_pk,raise_exception=True)
|
||||
def plannedsession_comment_view(request,id=0,userid=0):
|
||||
@@ -542,6 +544,8 @@ def plannedsession_create_view(request,
|
||||
if request.GET.get('startdate') or request.GET.get('when'):
|
||||
startdate, enddate = get_dates_timeperiod(request)
|
||||
|
||||
|
||||
|
||||
sps = get_sessions(r,startdate=startdate,enddate=enddate).exclude(
|
||||
sessiontype='race')
|
||||
|
||||
@@ -549,6 +553,13 @@ def plannedsession_create_view(request,
|
||||
manager=request.user,
|
||||
is_template=True).order_by("name")
|
||||
|
||||
tag = request.GET.get('tag')
|
||||
if tag:
|
||||
tags = [tag]
|
||||
sessiontemplates = sessiontemplates.filter(tags__name__in=tags).distinct()
|
||||
|
||||
alltags = Tag.objects.all()
|
||||
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
startdate__lte = startdate,
|
||||
@@ -575,6 +586,7 @@ def plannedsession_create_view(request,
|
||||
'sessiontemplates':sessiontemplates,
|
||||
'rower':r,
|
||||
'timeperiod':timeperiod,
|
||||
'alltags':alltags,
|
||||
})
|
||||
|
||||
@user_passes_test(can_plan,login_url="/rowers/paidplans/",
|
||||
@@ -1687,7 +1699,10 @@ def plannedsession_templateedit_view(request,id=0):
|
||||
elif cd['sessionunit'] in ['km','m']:
|
||||
cd['sessionmode'] = 'distance'
|
||||
|
||||
obj = sessioncreateform.save()
|
||||
|
||||
res, message = update_plannedsession(ps,cd)
|
||||
#sessioncreateform.save_m2m()
|
||||
|
||||
if res:
|
||||
messages.info(request,message)
|
||||
|
||||
@@ -79,6 +79,7 @@ INSTALLED_APPS = [
|
||||
'django_social_share',
|
||||
'django_countries',
|
||||
'rules',
|
||||
'taggit',
|
||||
]
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
@@ -581,3 +582,5 @@ except KeyError:
|
||||
RECAPTCHA_SITE_SECRET = ''
|
||||
|
||||
GEOIP_PATH = STATIC_ROOT
|
||||
|
||||
TAGGIT_CASE_INSENSITIVE = True
|
||||
|
||||
Reference in New Issue
Block a user