-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(export-json): Export User workout in JSON format
Currently, wger only supports a user downloading their workout information in pdf format which is not interoperable. This commit introduces exporting a user's workout information in JSON format which promotes interoperability [Delivers #157731622]
- Loading branch information
Showing
23 changed files
with
446 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.13 on 2018-06-16 10:04 | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('manager', '0009_merge'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ImportJsonDocument', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('json_document', models.FileField(upload_to='documents/')), | ||
('uploaded_at', models.DateTimeField(auto_now_add=True)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.13 on 2018-06-19 11:31 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('manager', '0010_importjsondocument'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='workout', | ||
name='exported_from', | ||
field=models.CharField(blank=True, default='', max_length=100, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.13 on 2018-06-19 11:51 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('manager', '0011_workout_exported_from'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='workout', | ||
old_name='exported_from', | ||
new_name='imported_from', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.13 on 2018-06-21 06:17 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('manager', '0010_auto_20180620_1044'), | ||
('manager', '0012_auto_20180619_1451'), | ||
] | ||
|
||
operations = [ | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.13 on 2018-06-21 10:41 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('manager', '0013_merge'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='workouttype', | ||
name='category', | ||
field=models.CharField(choices=[('1', 'Default'), ('2', 'Dropset')], default='1', max_length=10), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% extends "base.html" %} | ||
{% load i18n %} | ||
{% load staticfiles %} | ||
|
||
{% block title %}{% trans "Your Imports & Exports" %}{% endblock %} | ||
|
||
|
||
{% block content %} | ||
{% if imports %} | ||
<div class="table-responsive"> | ||
<table class="table table-hovered table-bordered table-checked table-hovered"> | ||
<tr> | ||
<th>{% trans "Import Date"%}</th> | ||
<th>{% trans "Description" %}</th> | ||
<th>{% trans "Sets per Day"%}</th> | ||
<th>{% trans "Workout Days"%}</th> | ||
<th>{% trans "Overview" %}</th> | ||
{% comment %} <th>{% trans "Action" %}</th> {% endcomment %} | ||
</tr> | ||
{{table_content|safe}} | ||
</table> | ||
</div> | ||
{% else %} | ||
<h4>{% trans message %}</h4> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
|
||
{% block sidebar %} | ||
<h4>{% trans "Your imports" %}</h4> | ||
<p>{% blocktrans %} | ||
This shows all your recent imported workouts | ||
{% endblocktrans %} | ||
</p> | ||
<hr/> | ||
<h4>{%trans "Import Workout "%}</h4> | ||
<form action="{% url 'manager:workout:export_json' user.pk %}" method="post" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
<br/> | ||
<input type="file" name="json_document" class="form-control" required="required" accept=".json,.JSON"/> | ||
<input type="hidden" name="user" id="user" value="{{user.pk}}" > | ||
<br/> | ||
<button class="btn btn-primary btn-block" type="submit">{% trans "UPLOAD JSON FILE" %}</button> | ||
</form> | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.