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

Add tools to import and export exercises #515

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Veltarn
Copy link
Contributor

@Veltarn Veltarn commented Sep 7, 2020

Proposed Changes

I created a tool to import and export exercises in xml format. It also includes images, converted to base64 and wrote in the xml file.

Other questions

  • I added some lines to the .gitignore file as my development setup has the media directory inside wger directory, is this a problem ?

@rolandgeider
Copy link
Member

Another thing, make sure that the file is formatted according to PEP8. If you install flake8 and isort in the virtual env, you can check it with

flake8 --config .github/linters/.flake8

isort automatically sorts the imports: isort .

@rolandgeider
Copy link
Member

And of course thanks for the PR, I hope I haven't made too many comments :)

@Veltarn
Copy link
Contributor Author

Veltarn commented Sep 7, 2020

Thanks for the answer, I just saw one comment, I don't think it's that many haha
Are you sure you've posted the others ?

I'm looking at the PEP8 formatting tomorow

wger/core/templates/navigation.html Outdated Show resolved Hide resolved
@@ -0,0 +1,4750 @@
# SOME DESCRIPTIVE TITLE.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't check in the PO, at the moment it's a bit tricky becaue the exercise categories are extracted from the DB and need to be added as well. There's a script or a HOWTO somewhere. And the MO files are binary, I only compile and check them in before a release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh... I forgot to toss them out before the commit :x

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👆🏻

wger/exercises/templates/export/overview.html Outdated Show resolved Hide resolved
wger/exercises/templates/export/overview.html Outdated Show resolved Hide resolved
wger/exercises/templates/import/overview.html Outdated Show resolved Hide resolved
wger/exercises/views/export.py Outdated Show resolved Hide resolved
wger/exercises/views/export.py Outdated Show resolved Hide resolved
wger/exercises/views/import_exercises.py Outdated Show resolved Hide resolved
wger/exercises/views/import_exercises.py Outdated Show resolved Hide resolved
wger/exercises/views/import_exercises.py Outdated Show resolved Hide resolved
@rolandgeider
Copy link
Member

I actually didn't post them! 🙈

Turns out, that if you add the comments as a review and not as regular comments, you have to accept them all after finishing

@Veltarn
Copy link
Contributor Author

Veltarn commented Sep 7, 2020

Perfect, I have some bit of work I will do this week before pushing the proposal to the few changes on the workout mode.

@rolandgeider
Copy link
Member

👍🏻👍🏻

@Veltarn Veltarn changed the title Added import and exportation exercices tools Added tools to import and export exercises Sep 12, 2020
@Veltarn Veltarn changed the title Added tools to import and export exercises Add tools to import and export exercises Sep 12, 2020
@Veltarn
Copy link
Contributor Author

Veltarn commented Sep 13, 2020

Fixes done.

I forgot to say, the two menus can be reached in the Training menu if the member has the "exercises.change_exercise" permission.

You can export all the exercises or just the exercises for your language.

Copy link
Member

@rolandgeider rolandgeider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes done.

I forgot to say, the two menus can be reached in the Training menu if the member has the "exercises.change_exercise" permission.

You can export all the exercises or just the exercises for your language.

I was thinking about that. It would be OK for regular users to export the data for the exercises, e.g. to import them to their own instance, so we don't need to check for anything. But I'm not sure where to put the link, since it's something that 99% of users will not need. We can leave it where it is for the moment

<div class="card-body">
<h5 class="card-title">{% trans "number_all_exercices" %}: {{ number_exercises }}</h5>
<div class="card-text">
<a class="btn btn-sm btn-primary" href="{% url 'exercise:export:export_exercises' 'all' %}">{% trans "export_all_exercices" %}</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also remove the keyword translations here :)

<!--
Title
-->
{% block title %}{% trans "Export des exercices" %}{% endblock %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S'il vous plaît en anglais ;)

@@ -0,0 +1,4750 @@
# SOME DESCRIPTIVE TITLE.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👆🏻

@Veltarn
Copy link
Contributor Author

Veltarn commented Dec 3, 2020

Why not in the user account page ?
A button to export and / or import exercises rather than in the main exercises menu ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants