instantplans
This commit is contained in:
@@ -1715,6 +1715,8 @@ class InstantPlan(models.Model):
|
||||
price = models.IntegerField(default=0, verbose_name="Price in EURO")
|
||||
url = models.CharField(max_length=250, blank=True,
|
||||
verbose_name="Link to page with more information")
|
||||
private = models.BooleanField(default=False,
|
||||
verbose_name="Hidden, personal")
|
||||
|
||||
def __str__(self): # pragma: no cover
|
||||
return self.name
|
||||
@@ -1753,6 +1755,7 @@ class InstantPlanForm(ModelForm):
|
||||
'hoursperweek',
|
||||
'sessionsperweek',
|
||||
'yaml',
|
||||
'private'
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
<p>Created by: {{ plan.owner.first_name }} {{ plan.owner.last_name }}</p>
|
||||
<p>Plan length: {{ plan.duration }} days</p>
|
||||
<p>{{ plan.description }}</p>
|
||||
{% if plan.private %}
|
||||
<p><em>Private</em></p>
|
||||
{% endif %}
|
||||
{% if plan.target %}
|
||||
<p>What the plan will achieve: {{ plan.target }}</p>
|
||||
{% endif %}
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -848,7 +848,12 @@ def rower_register_view(request):
|
||||
weightcategory = form.cleaned_data['weightcategory']
|
||||
adaptiveclass = form.cleaned_data['adaptiveclass']
|
||||
nextpage = request.POST['next']
|
||||
theuser = User.objects.create_user(username, password=password)
|
||||
try:
|
||||
theuser = User.objects.create_user(username, password=password)
|
||||
except:
|
||||
messages.error(request, "This user name already exists, choose another one")
|
||||
url = reverse('rower_register_view')
|
||||
return HttpResponseRedirect(url)
|
||||
theuser.first_name = first_name
|
||||
theuser.last_name = last_name
|
||||
theuser.email = email
|
||||
|
||||
@@ -2849,8 +2849,15 @@ def rower_select_instantplan(request, id=0):
|
||||
r = getrequestrower(request, userid=id)
|
||||
|
||||
# get and present available plans
|
||||
ips = InstantPlan.objects.all().order_by(
|
||||
"name", "sessionsperweek", "hoursperweek", "duration", "id")
|
||||
ips = InstantPlan.objects.filter(private=False)
|
||||
|
||||
if not request.user.is_anonymous:
|
||||
|
||||
ips2 = InstantPlan.objects.filter(owner=request.user)
|
||||
|
||||
ips = ips | ips2
|
||||
|
||||
ips = ips.order_by("private", "name", "sessionsperweek", "hoursperweek", "duration", "id")
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user