Move ALLOW_UPLOADS to BABY_BUDDY dict

This commit is contained in:
Isaac Bythewood 2017-12-01 18:07:08 -05:00 committed by Christopher Charbonneau Wells
parent 0c57e21c02
commit 969958df09
5 changed files with 6 additions and 7 deletions

View File

@ -139,8 +139,6 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
WHITENOISE_ROOT = os.path.join(BASE_DIR, 'static', 'root')
ALLOW_UPLOADS = os.environ.get('ALLOW_UPLOADS', True)
# Django Rest Framework
# http://www.django-rest-framework.org/#
@ -165,5 +163,6 @@ REST_FRAMEWORK = {
BABY_BUDDY = {
'NAP_START_MIN': os.environ.get('NAP_START_MIN', '06:00'),
'NAP_START_MAX': os.environ.get('NAP_START_MAX', '18:00')
'NAP_START_MAX': os.environ.get('NAP_START_MAX', '18:00'),
'ALLOW_UPLOADS': os.environ.get('ALLOW_UPLOADS', True)
}

View File

@ -1,7 +1,7 @@
from .base import *
ALLOW_UPLOADS = os.environ.get('ALLOW_UPLOADS', False)
BABY_BUDDY['ALLOW_UPLOADS'] = os.environ.get('ALLOW_UPLOADS', False)
# Database

View File

@ -3,7 +3,7 @@ import dj_database_url
from .base import *
ALLOW_UPLOADS = os.environ.get('ALLOW_UPLOADS', False)
BABY_BUDDY['ALLOW_UPLOADS'] = os.environ.get('ALLOW_UPLOADS', False)
# Database

View File

@ -13,7 +13,7 @@ class ChildAdmin(admin.ModelAdmin):
list_filter = ('last_name',)
search_fields = ('first_name', 'last_name', 'birth_date')
fields = ['first_name', 'last_name', 'birth_date']
if settings.ALLOW_UPLOADS:
if settings.BABY_BUDDY['ALLOW_UPLOADS']:
fields.append('picture')

View File

@ -46,7 +46,7 @@ class ChildForm(forms.ModelForm):
'last_name',
'birth_date'
]
if settings.ALLOW_UPLOADS:
if settings.BABY_BUDDY['ALLOW_UPLOADS']:
fields.append('picture')
widgets = {
'birth_date': forms.DateInput(attrs={