Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Update views.py to match the original coding style

Brandon Lu01b3df0c2974
diff --git a/wger/software/views.py b/wger/software/views.py
index 139f603bf..5127630d3 100644
--- a/wger/software/views.py
+++ b/wger/software/views.py
@@ -35,7 +35,7 @@ from wger.nutrition.models import Ingredient
logger = logging.getLogger(__name__)
-CACHE_KEY = "landing-page-context"
+CACHE_KEY = 'landing-page-context'
def features(request):
@@ -45,28 +45,22 @@ def features(request):
context = cache.get(CACHE_KEY)
if not context:
- result_github_api = requests.get(
- "https://api.github.com/repos/wger-project/wger"
- ).json()
+ result_github_api = requests.get('https://api.github.com/repos/wger-project/wger').json()
context = {
- "nr_users": User.objects.count(),
- "nr_exercises": ExerciseBase.objects.count(),
- "nr_ingredients": Ingredient.objects.count(),
- "nr_stars": result_github_api.get("stargazers_count", "2000"),
+ 'nr_users': User.objects.count(),
+ 'nr_exercises': ExerciseBase.objects.count(),
+ 'nr_ingredients': Ingredient.objects.count(),
+ 'nr_stars': result_github_api.get('stargazers_count', '2000'),
}
-
cache.set(CACHE_KEY, context, 60 * 60 * 24 * 7) # one week
- FormClass = (
- RegistrationForm
- if settings.WGER_SETTINGS["USE_RECAPTCHA"]
+ FormClass = RegistrationForm if settings.WGER_SETTINGS['USE_RECAPTCHA'] \
else RegistrationFormNoCaptcha
- )
form = FormClass()
- form.fields["username"].widget.attrs.pop("autofocus", None)
+ form.fields['username'].widget.attrs.pop("autofocus", None)
- context["form"] = form
- context["allow_registration"] = settings.WGER_SETTINGS["ALLOW_REGISTRATION"]
- context["allow_guest_users"] = settings.WGER_SETTINGS["ALLOW_GUEST_USERS"]
+ context['form'] = form
+ context['allow_registration'] = settings.WGER_SETTINGS['ALLOW_REGISTRATION']
+ context['allow_guest_users'] = settings.WGER_SETTINGS['ALLOW_GUEST_USERS']
- return render(request, "features.html", context)
+ return render(request, 'features.html', context)