Commit d785b626 authored by Erlend Ydse's avatar Erlend Ydse
Browse files

Remove commented out code

parent d0cbe39f
#import logging
import os
import dj_database_url
......@@ -25,25 +24,16 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
if env.startswith('HEROKU_POSTGRESQL'):
db_color = env[len('HEROKU_POSTGRESQL_'):].split('_')[0]
#logger.info('Adding ${} to DATABASES Django setting ({}).'.format(env, db_color))
config['DATABASES'][db_color] = dj_database_url.parse(url, conn_max_age=conn_max_age, ssl_require=True)
if 'DATABASE_URL' in os.environ:
#logger.info('Adding $DATABASE_URL to default DATABASE Django setting.')
# Configure Django for DATABASE_URL environment variable.
config['DATABASES']['default'] = dj_database_url.config(conn_max_age=conn_max_age, ssl_require=True)
#logger.info('Adding $DATABASE_URL to TEST default DATABASE Django setting.')
# Enable test database if found in CI environment.
if 'CI' in os.environ:
config['DATABASES']['default']['TEST'] = config['DATABASES']['default']
#else:
#logger.info('$DATABASE_URL not found, falling back to previous settings!')
if test_runner:
# Enable test runner if found in CI environment.
if 'CI' in os.environ:
......@@ -51,8 +41,6 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
# Staticfiles configuration.
if staticfiles:
#logger.info('Applying Heroku Staticfiles configuration to Django settings.')
config['STATIC_ROOT'] = os.path.join(config['BASE_DIR'], 'staticfiles')
config['STATIC_URL'] = '/static/'
......@@ -69,45 +57,8 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
config['STATICFILES_STORAGE'] = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
if allowed_hosts:
#logger.info('Applying Heroku ALLOWED_HOSTS configuration to Django settings.')
config['ALLOWED_HOSTS'] = ['*']
"""
if logging:
logger.info('Applying Heroku logging configuration to Django settings.')
config['LOGGING'] = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(asctime)s [%(process)d] [%(levelname)s] ' +
'pathname=%(pathname)s lineno=%(lineno)s ' +
'funcname=%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S'
},
'simple': {
'format': '%(levelname)s %(message)s'
}
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'testlogger': {
'handlers': ['console'],
'level': 'INFO',
}
}
}
"""
# SECRET_KEY configuration.
if secret_key:
if 'SECRET_KEY' in os.environ:
......
......@@ -11,7 +11,6 @@ class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
form = CustomUserChangeForm
model = get_user_model()
# list_display = UserAdmin.list_display + ('coach',)
fieldsets = UserAdmin.fieldsets + ((None, {"fields": ("coach",)}),)
add_fieldsets = UserAdmin.add_fieldsets + ((None, {"fields": ("coach",)}),)
......
......@@ -83,7 +83,6 @@ class UserDetail(
return self.update(request, *args, **kwargs)
def patch(self, request, *args, **kwargs):
#self.serializer_class = UserPutSerializer
return self.partial_update(request, *args, **kwargs)
......
......@@ -11,21 +11,6 @@ async function fetchFriendRequests() {
}
}
// async function fetchFriends(id) {
// // Might just get from currentuser
// let response = await sendRequest("GET", `${HOST}/api/users/${id}/`);
// if (!response.ok) {
// throw new Error(`HTTP error! status: ${response.status}`);
// } else {
// let data = await response.json();
// let friends = data.results;
// return friends;
// }
// }
/**
*
* @param {String} username
......@@ -74,11 +59,6 @@ async function addFriend(url) {
}
}
// async function rejectFriend(id) {
// const currentUser = await getCurrentUser();
// console.log(`Removing friend ${id} from ${JSON.stringify(currentUser)}`);
// }
/**
*
* @param {{name: String, id: Number, date: Date}[]} friendRequests
......@@ -91,8 +71,6 @@ function renderFriendRequests(friendRequests) {
);
const cloneFriendRequest = templateFriendRequest.content.cloneNode(true);
// const divFriendRequest = cloneFriendRequest.querySelector("div.d-flex");
const h5 = cloneFriendRequest.querySelector("h5");
h5.textContent = friendRequest.name;
......@@ -182,9 +160,6 @@ async function searchFriends() {
}
window.addEventListener("DOMContentLoaded", async () => {
// const req = await fetchFriendRequests();
// console.log(req);
// renderFriendRequests(req);
const user = await getCurrentUser();
console.log(user)
await renderFriends(user.symmetric_friends);
......
......@@ -205,7 +205,6 @@ async function submitRoster() {
const form = new FormData();
form.append("status", "p");
form.append("recipient", athlete.url);
// let body = {'status': 'p', 'recipient': athlete.url};
let response = await sendRequest(
"POST",
`${HOST}/api/offers/`,
......
......@@ -52,13 +52,11 @@ async function displayOffers() {
let acceptButton = buttons[0];
let declineButton = buttons[1];
//acceptButton.id = `btn-accept-${offer.id}`;
acceptButton.addEventListener(
"click",
async (event) => await acceptOffer(event, offer.url, offer.owner)
);
//declineButton.id = `btn-decline-${offer.id}`;
declineButton.addEventListener(
"click",
async (event) => await declineOffer(event, offer.url)
......
......@@ -59,19 +59,7 @@ async function markViewedWorkout(workouts, currentUser) {
return
}
const lastWorkout = workouts.map(workout => workout.id).sort((a, b) => b - a)[0];
// const form = new FormData();
// form.append("last_seen_workout", lastWorkout)
// const response = await sendRequest("PATCH", `${HOST}/api/users/${currentUser.id}/`, form, "")
localStorage.setItem(`last_seen_workout_${currentUser.username}`, JSON.stringify(lastWorkout))
// if (response.ok) {
// const data = await response.json();
// console.log(`Updated last seen, data: ${JSON.stringify(data)}`)
// } else {
// const data = await response.json();
// const alert = createAlert("Could not add friend!", data);
// document.body.prepend(alert);
// }
}
window.addEventListener("DOMContentLoaded", async () => {
......
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