Commit 3d4355a9 authored by Erlend Ydse's avatar Erlend Ydse
Browse files

Merge nested if statements equivalent to and relation

parent d785b626
......@@ -34,10 +34,9 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
if 'CI' in os.environ:
config['DATABASES']['default']['TEST'] = config['DATABASES']['default']
if test_runner:
if test_runner and 'CI' in os.environ:
# Enable test runner if found in CI environment.
if 'CI' in os.environ:
config['TEST_RUNNER'] = 'django_heroku.HerokuDiscoverRunner'
config['TEST_RUNNER'] = 'django_heroku.HerokuDiscoverRunner'
# Staticfiles configuration.
if staticfiles:
......@@ -60,8 +59,6 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
config['ALLOWED_HOSTS'] = ['*']
# SECRET_KEY configuration.
if secret_key:
if 'SECRET_KEY' in os.environ:
#logger.info('Adding $SECRET_KEY to SECRET_KEY Django setting.')
# Set the Django setting from the environment variable.
config['SECRET_KEY'] = os.environ['SECRET_KEY']
if secret_key and 'SECRET_KEY' in os.environ:
# Set the Django setting from the environment variable.
config['SECRET_KEY'] = os.environ['SECRET_KEY']
......@@ -99,9 +99,8 @@ class UserPutSerializer(serializers.ModelSerializer):
instance.bio = validated_data["bio"]
if "profile_image" in validated_data:
instance.profile_image = validated_data["profile_image"]
if "symmetric_friends" in validated_data:
if len(validated_data["symmetric_friends"]) > 0:
instance.symmetric_friends.add(validated_data["symmetric_friends"][0])
if "symmetric_friends" in validated_data and len(validated_data["symmetric_friends"]) > 0:
instance.symmetric_friends.add(validated_data["symmetric_friends"][0])
return instance
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment