Skip to content

Commit

Permalink
Merge be120f6 into e85134c
Browse files Browse the repository at this point in the history
  • Loading branch information
Tevinthuku committed May 31, 2019
2 parents e85134c + be120f6 commit 6d749e0
Show file tree
Hide file tree
Showing 176 changed files with 1,468 additions and 2,027 deletions.
Binary file added .DS_Store
Binary file not shown.
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#### Title
<!-- A short description of what needs to be done. -->

#### Description
<!-- Why is it needed? Does it help the team go faster or is it a dependency that could cause problems in the codebase if it’s not done? -->

<!-- Note: Every story title should include the word ‘should’ as opposed to ‘can’. e.g. It’s unclear whether the story “User can delete comment” is a feature or a bug. “User should be able to delete comment” or “User should not be able to delete comment” are much clearer: the former is a feature, the latter a bug. -->


#### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)

- [ ] New feature (non-breaking change which adds functionality)


- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)


- [ ] This change requires a documentation update


#### How Has This Been Tested?

#### Acceptance Criteria:
<!-- THis section is applicable to tasks -->
<!-- These should include conditions that must be met for the chore to be accepted. -->

#### Checklist:


#### PT stories
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
venv-django/
build/
develop-eggs/
dist/
Expand Down Expand Up @@ -62,3 +63,6 @@ target/
# External Libraries
wger/core/static/bower_components
node_modules
venv/
venv-django/
.vscode/
40 changes: 13 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: xenial
language: python

# Cache the pip files
Expand All @@ -10,22 +11,14 @@ cache:

# Use container infrastructure
# http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/
sudo: false
sudo: true

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

# Manually define here the combinations environment variables to test
# https://github.com/travis-ci/travis-ci/issues/1519
env:
- TEST_MOBILE=True DB=postgresql TRAVIS_NODE_VERSION="4"
- TEST_MOBILE=True DB=sqlite TRAVIS_NODE_VERSION="4"
- TEST_MOBILE=False DB=postgresql TRAVIS_NODE_VERSION="4"
- TEST_MOBILE=False DB=sqlite TRAVIS_NODE_VERSION="4"

- TEST_MOBILE=False DB=sqlite TRAVIS_NODE_VERSION="4"
# Install the application
install:
# Update nvm and set wanted Node version.
Expand All @@ -38,30 +31,23 @@ install:
- nvm use $TRAVIS_NODE_VERSION

# Install requirements
- pip install -r requirements_devel.txt
- pip install -r requirements.txt
- npm install
- if [[ "$DB" = "postgresql" ]]; then pip install psycopg2; fi

# Setup application
- if [[ "$DB" = "sqlite" ]]; then invoke create_settings; fi
- if [[ "$DB" = "postgresql" ]]; then invoke create_settings --database-type postgresql; fi
- pip install coveralls

# Create test databases
before_script:
- if [[ "$DB" = "postgresq" ]]; then psql -c 'DROP DATABASE IF EXISTS test_wger;' -U postgres; fi
- if [[ "$DB" = "postgresql" ]]; then psql -c 'CREATE DATABASE test_wger;' -U postgres; fi
- invoke create-settings --settings-path ./wger/settings.py --database-path ./wger/database.sqlite
- invoke bootstrap-wger --settings-path ./wger/settings.py --no-start-server

# Do the tests
script:
# Formatting
- pep8 wger

# Javascript linting
- gulp lint

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

- coverage run --source=wger manage.py test

# Code coverage
- coverage report
- coveralls

after_success:
- coveralls
35 changes: 18 additions & 17 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#!/usr/bin/env python
import os
import sys

from django.core.management import execute_from_command_line

from tasks import (
setup_django_environment,
get_user_config_path
)

if __name__ == "__main__":

# If user passed the settings flag ignore the default wger settings
if not any('--settings' in s for s in sys.argv):
setup_django_environment(get_user_config_path('wger', 'settings.py'))

# Alternative to above
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

execute_from_command_line(sys.argv)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wger.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
"eslint-plugin-react": "^6.1.2",
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1"
},
"dependencies": {
"bower": "^1.8.8"
}
}
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Requirements for wger for production
#

Django>=1.9,<1.10
Django
django-recaptcha
reportlab
django_mobile
django-formtools>=1.0,<1.1
django-formtools
bleach
python-mimeparse
pillow
Expand All @@ -21,7 +21,7 @@ invoke
requests

# REST API
djangorestframework>=3.2,<3.3
djangorestframework
django-filter
django-tastypie
django-cors-headers
Expand Down
2 changes: 1 addition & 1 deletion requirements_devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
-r requirements.txt

# Development packages
pep8
pycodestyle
django-debug-toolbar
coverage
32 changes: 15 additions & 17 deletions wger/config/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Generated by Django 2.2.1 on 2019-05-29 07:29

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


class Migration(migrations.Migration):

initial = True

dependencies = [
('gym', '0001_initial'),
('core', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='GymConfig',
name='LanguageConfig',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('default_gym', models.ForeignKey(blank=True, to='gym.Gym', help_text='Select the default gym for this installation. This will assign all new registered users to this gym and update all existing users without a gym.', null=True, verbose_name='Default gym')),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('item', models.CharField(choices=[('1', 'Exercises'), ('2', 'Ingredients')], editable=False, max_length=2)),
('show', models.BooleanField(default=1)),
('language', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='language_source', to='core.Language')),
('language_target', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='language_target', to='core.Language')),
],
options={
'ordering': ['item', 'language_target'],
},
bases=(models.Model,),
),
migrations.CreateModel(
name='LanguageConfig',
name='GymConfig',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('item', models.CharField(max_length=2, editable=False, choices=[(b'1', 'Exercises'), (b'2', 'Ingredients')])),
('show', models.BooleanField(default=1)),
('language', models.ForeignKey(related_name='language_source', editable=False, to='core.Language')),
('language_target', models.ForeignKey(related_name='language_target', editable=False, to='core.Language')),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('default_gym', models.ForeignKey(blank=True, help_text='Select the default gym for this installation. This will assign all new registered users to this gym and update all existing users without a gym.', null=True, on_delete=django.db.models.deletion.CASCADE, to='gym.Gym', verbose_name='Default gym')),
],
options={
'ordering': ['item', 'language_target'],
},
bases=(models.Model,),
),
]
6 changes: 3 additions & 3 deletions wger/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class LanguageConfig(models.Model):

language = models.ForeignKey(Language,
related_name='language_source',
editable=False)
editable=False,on_delete=models.CASCADE)
language_target = models.ForeignKey(Language,
related_name='language_target',
editable=False)
editable=False, on_delete=models.CASCADE)
item = models.CharField(max_length=2,
choices=SHOW_ITEM_LIST,
editable=False)
Expand Down Expand Up @@ -114,7 +114,7 @@ class GymConfig(models.Model):
'gym and update all existing users without a '
'gym.'),
null=True,
blank=True)
blank=True,on_delete=models.CASCADE)
'''
Default gym for the wger installation
'''
Expand Down
2 changes: 1 addition & 1 deletion wger/config/tests/test_gym_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.

from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.urls import reverse

from wger.config.models import GymConfig
from wger.core.models import UserProfile
Expand Down
22 changes: 11 additions & 11 deletions wger/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@
# You should have received a copy of the GNU Affero General Public License
# along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.

from django.conf.urls import patterns, url, include
from django.urls import path, include

from wger.config.views import language_config
from wger.config.views import gym_config


app_name = "config"
# sub patterns for language configs
patterns_language_config = [
url(r'^(?P<pk>\d+)/edit',
language_config.LanguageConfigUpdateView.as_view(),
name='edit'),
path(r'<pk>/edit',
language_config.LanguageConfigUpdateView.as_view(),
name='edit'),
]


# sub patterns for default gym
patterns_gym_config = [
url(r'^edit$',
gym_config.GymConfigUpdateView.as_view(),
name='edit'),
path(r'edit',
gym_config.GymConfigUpdateView.as_view(),
name='edit'),
]


#
# Actual patterns
#
urlpatterns = [
url(r'^language-config/', include(patterns_language_config, namespace="language_config")),
url(r'^gym-config/', include(patterns_gym_config, namespace="gym_config")),
]
path(r'language-config/', include((patterns_language_config, "config"), namespace="language_config")),
path(r'gym-config/', include((patterns_gym_config, "config"), namespace="gym_config")),
]
2 changes: 1 addition & 1 deletion wger/config/views/gym_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import logging

from django.core.urlresolvers import reverse, reverse_lazy
from django.urls import reverse, reverse_lazy
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView

Expand Down
2 changes: 1 addition & 1 deletion wger/config/views/language_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import logging

from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.core.urlresolvers import reverse, reverse_lazy
from django.urls import reverse, reverse_lazy
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView

Expand Down
Loading

0 comments on commit 6d749e0

Please sign in to comment.