Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.common.BrokenLinkEmailsMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"reversion.middleware.RevisionMiddleware",
"allauth.account.middleware.AccountMiddleware",
Expand Down
11 changes: 8 additions & 3 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
"maxBytes": 1024 * 1024 * 15, # 15MB
"backupCount": 10,
},
"null": {
"class": "logging.NullHandler",
},
},
"root": {"level": "INFO", "handlers": ["console"]},
"loggers": {
Expand All @@ -200,10 +203,12 @@
"level": "ERROR",
"propagate": True,
},
# Bots hitting the ALB by IP send a Host header not in ALLOWED_HOSTS.
# Django already answers 400; logging these just buries real errors
# (and would trigger mail_admins if that's ever enabled).
"django.security.DisallowedHost": {
"level": "ERROR",
"handlers": ["console"],
"propagate": True,
"handlers": ["null"],
"propagate": False,
},
"anymail": {
"handlers": ["console", "applogfile"],
Expand Down
12 changes: 4 additions & 8 deletions teleband/dashboards/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def test_func(self):

def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
ctx["courses"] = (
Course.objects.select_related("owner").order_by("-start_date", "name")
ctx["courses"] = Course.objects.select_related("owner").order_by(
"-start_date", "name"
)
return ctx

Expand Down Expand Up @@ -238,9 +238,7 @@ def research_data_view(request):
atts_by_sub = defaultdict(list)
for att in attachments:
if att.file:
atts_by_sub[att.submission_id].append(
{"id": att.id, "url": att.file.url}
)
atts_by_sub[att.submission_id].append({"id": att.id, "url": att.file.url})

subs_by_ca = defaultdict(list)
for sub in submissions:
Expand Down Expand Up @@ -270,9 +268,7 @@ def research_data_view(request):
assn_data["submissions"].append(
{
"id": sub.id,
"student": sub.enrollment.user.id
if sub.enrollment
else None,
"student": sub.enrollment.user.id if sub.enrollment else None,
"instrument": str(sub.instrument) if sub.instrument else None,
"submitted": sub.submitted.strftime("%Y-%m-%d %H:%M"),
"content": sub.content,
Expand Down
Loading