Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#144208805 Feature: Export Workouts. #2

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ coverage.xml
# Translations
*.mo
*.pot

.DS_Store
# Django stuff:
*.log
settings*.py
settings.py
*.sqlite
/CACHE

Expand Down
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ sudo: false

# Python versions to test
python:
- "2.7"
- "3.4"
- "3.5"
# - "2.7"
- "3.6"


# Manually define here the combinations environment variables to test
# https://github.com/travis-ci/travis-ci/issues/1519
Expand All @@ -37,6 +37,9 @@ install:
- nvm install $TRAVIS_NODE_VERSION
- nvm use $TRAVIS_NODE_VERSION

# upgrade setuptools separately to avoid race condition
- pip install -U setuptools

# Install requirements
- pip install -r requirements_devel.txt
- npm install
Expand All @@ -60,7 +63,7 @@ script:
- gulp lint

# Regular application
- coverage run --source='.' ./manage.py test
- coverage run --source='wger' ./manage.py test


# Code coverage
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn wger.wsgi --log-file -
web: python manage.py runserver 0.0.0.0:$PORT
2 changes: 2 additions & 0 deletions logfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FATAL: pre-existing shared memory block (key 5432001, ID 262144) is still in use
HINT: If you're sure there are no old server processes still running, remove the shared memory block or just delete the file "postmaster.pid".
20 changes: 20 additions & 0 deletions wger/config/migrations/0002_auto_20170428_2135.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-28 18:35
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('config', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='languageconfig',
name='item',
field=models.CharField(choices=[('1', 'Exercises'), ('2', 'Ingredients')], editable=False, max_length=2),
),
]
20 changes: 20 additions & 0 deletions wger/core/migrations/0010_auto_20170428_2135.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-28 18:35
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0009_auto_20160303_2340'),
]

operations = [
migrations.AlterField(
model_name='license',
name='full_name',
field=models.CharField(help_text='If a license has been localized, e.g. the Creative Commons licenses for the different countries, add them as separate entries here.', max_length=60, verbose_name='Full name'),
),
]
46 changes: 46 additions & 0 deletions wger/core/templates/form2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% extends extend_template %}
{% load i18n staticfiles wger_extras django_bootstrap_breadcrumbs %}

{# #}
{# Breadcrumbs #}
{# #}
{% block breadcrumbs %}
{{ block.super }}

{% breadcrumb "Exporting and importing workouts enables you & friends to share custom workouts." workout.pk%}
{% endblock %}

{% block header %}

{{ form.media }}

{% if custom_js %}
<script type="text/javascript">
{{custom_js|safe}}
</script>
{% endif %}
{% endblock %}


{% block title %}{{title}}{% endblock %}


{% block content %}

<form action="{{form_action}}"
method="post"
class="form-horizontal"
role="form"
{% if enctype %}enctype="{{enctype}}"{% endif %}>
{% render_form_fields form submit_text %}
</form>

{% endblock %}



<!--
Side bar
-->
{% block sidebar %}{% if sidebar %}{% include sidebar %}
{% endif %}{% endblock %}
25 changes: 25 additions & 0 deletions wger/email/migrations/0002_auto_20170428_2135.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-28 18:35
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('email', '0001_initial'),
]

operations = [
migrations.AlterModelOptions(
name='log',
options={'ordering': ['-date']},
),
migrations.AlterField(
model_name='log',
name='gym',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='email_log', to='gym.Gym'),
),
]
45 changes: 45 additions & 0 deletions wger/exercises/migrations/0004_auto_20170428_2135.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-28 18:35
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('exercises', '0003_auto_20160921_2000'),
]

operations = [
migrations.AlterField(
model_name='exercise',
name='equipment',
field=models.ManyToManyField(blank=True, to='exercises.Equipment', verbose_name='Equipment'),
),
migrations.AlterField(
model_name='exercise',
name='muscles',
field=models.ManyToManyField(blank=True, to='exercises.Muscle', verbose_name='Primary muscles'),
),
migrations.AlterField(
model_name='exercise',
name='muscles_secondary',
field=models.ManyToManyField(blank=True, related_name='secondary_muscles', to='exercises.Muscle', verbose_name='Secondary muscles'),
),
migrations.AlterField(
model_name='exercise',
name='status',
field=models.CharField(choices=[('1', 'Pending'), ('2', 'Accepted'), ('3', 'Declined')], default='1', editable=False, max_length=2),
),
migrations.AlterField(
model_name='exerciseimage',
name='is_main',
field=models.BooleanField(default=False, help_text='Tick the box if you want to set this image as the main one for the exercise (will be shown e.g. in the search). The first image is automatically marked by the system.', verbose_name='Main picture'),
),
migrations.AlterField(
model_name='exerciseimage',
name='status',
field=models.CharField(choices=[('1', 'Pending'), ('2', 'Accepted'), ('3', 'Declined')], default='1', editable=False, max_length=2),
),
]
34 changes: 34 additions & 0 deletions wger/gym/migrations/0007_auto_20170428_2135.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-28 18:35
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('gym', '0006_auto_20160214_1013'),
]

operations = [
migrations.AlterModelOptions(
name='gym',
options={'ordering': ['name'], 'permissions': (('gym_trainer', 'Trainer: can see the users for a gym'), ('manage_gym', 'Admin: can manage users for a gym'), ('manage_gyms', 'Admin: can administrate the different gyms'))},
),
migrations.AlterField(
model_name='contract',
name='options',
field=models.ManyToManyField(blank=True, to='gym.ContractOption', verbose_name='Options'),
),
migrations.AlterField(
model_name='gymadminconfig',
name='overview_inactive',
field=models.BooleanField(default=True, help_text='Receive email overviews of inactive members', verbose_name='Overview of inactive members'),
),
migrations.AlterField(
model_name='gymconfig',
name='weeks_inactive',
field=models.PositiveIntegerField(default=4, help_text='Number of weeks since the last time a user logged his presence to be considered inactive', verbose_name='Reminder of inactive members'),
),
]
6 changes: 6 additions & 0 deletions wger/manager/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class WorkoutCopyForm(Form):
required=False)


class WorkoutExportForm(Form):
comment = CharField(max_length=100,
help_text=_('Give a title to this workout export.'),
required=False)


class DayForm(ModelForm):
class Meta:
model = Day
Expand Down
21 changes: 21 additions & 0 deletions wger/manager/migrations/0008_auto_20170428_2135.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-28 18:35
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('manager', '0007_auto_20160311_2258'),
]

operations = [
migrations.AlterField(
model_name='setting',
name='reps',
field=models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(600)], verbose_name='Amount'),
),
]
1 change: 1 addition & 0 deletions wger/manager/templates/workout/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ <h4 class="list-group-item-heading">{{ workout }}</h4>
<a href="{% url 'manager:workout:add' %}" class="btn btn-success btn-sm">
{% trans "Add workout" %}
</a>

{% endblock %}
12 changes: 12 additions & 0 deletions wger/manager/templates/workout/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,18 @@ <h4 class="modal-title">{% trans "Download as PDF" %}</h4>
{% trans "Make a copy of this workout" %}
</a>
</li>
<li>
<a href="{% url 'manager:workout:export' workout.id %}">
<span class="{% fa_class 'space-shuttle' %}"></span>
{% trans "Export this workout" %}
</a>
</li>
<li>
<a href="{% url 'manager:workout:imports' workout.id %}">
<span class="{% fa_class 'upload' %}"></span>
{% trans "Import custom workout" %}
</a>
</li>
{% if is_owner %}
<li role="separator" class="divider"></li>
<li>
Expand Down
6 changes: 6 additions & 0 deletions wger/manager/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
url(r'^add$',
workout.add,
name='add'),
url(r'^(?P<pk>\d+)/export/$',
workout.export,
name='export'),
url(r'^(?P<pk>\d+)/imports/$',
workout.imports,
name='imports'),
url(r'^(?P<pk>\d+)/copy/$',
workout.copy_workout,
name='copy'),
Expand Down
Loading