Fix prospector errors and move secret_key to yaml config
This commit is contained in:
parent
7c7b3469e9
commit
cde35515c7
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
"""Django manage.py"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fil
|
|||
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s'
|
||||
SECRET_KEY = CONFIG.get('secret_key')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
|
|
@ -29,6 +29,7 @@ secure_proxy_header:
|
|||
redis: localhost
|
||||
# Error reporting, sends stacktrace to sentry.services.beryju.org
|
||||
error_report_enabled: true
|
||||
secret_key: 9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s
|
||||
|
||||
passbook:
|
||||
sign_up:
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
from logging import getLogger
|
||||
|
||||
from django import template
|
||||
from django.apps import AppConfig
|
||||
from django.core.cache import cache
|
||||
from django.urls import reverse
|
||||
from django.urls.exceptions import NoReverseMatch
|
||||
|
||||
register = template.Library()
|
||||
LOGGER = getLogger(__name__)
|
||||
|
|
|
@ -145,10 +145,10 @@ def related_models(context, model_path):
|
|||
user = request.user
|
||||
|
||||
model = path_to_class(model_path)
|
||||
if not issubclass(model, UserAcquirable):
|
||||
# model_path is not actually a module
|
||||
# so we can't assume that it's usable
|
||||
return []
|
||||
# if not issubclass(model, UserAcquirable):
|
||||
# # model_path is not actually a module
|
||||
# # so we can't assume that it's usable
|
||||
# return []
|
||||
|
||||
return model.objects.filter(users__in=[user])
|
||||
|
||||
|
@ -161,4 +161,5 @@ def unslug(_input):
|
|||
|
||||
@register.filter(name='css_class')
|
||||
def css_class(field, css):
|
||||
return field.as_widget(attrs={"class": css})
|
||||
"""Add css class to form field"""
|
||||
return field.as_widget(attrs={"class": css})
|
||||
|
|
|
@ -195,7 +195,7 @@ class OAuthCallback(OAuthClientMixin, View):
|
|||
def handle_new_user(self, source, access, info):
|
||||
"Create a shell auth.User and redirect."
|
||||
was_authenticated = False
|
||||
if self.request.user.is_authenticated: # pylint: disable=no-else-return
|
||||
if self.request.user.is_authenticated:
|
||||
# there's already a user logged in, just link them up
|
||||
user = self.request.user
|
||||
was_authenticated = True
|
||||
|
|
Reference in New Issue