From 86bc0567f7e70df53537ec1f960e0afad8f4af75 Mon Sep 17 00:00:00 2001 From: Chris Clark Date: Mon, 22 Apr 2024 06:47:17 -0700 Subject: [PATCH] no email required (#606) --- explorer/forms.py | 8 ++------ explorer/templates/explorer/query.html | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/explorer/forms.py b/explorer/forms.py index 6ec5fb45..db631adc 100644 --- a/explorer/forms.py +++ b/explorer/forms.py @@ -42,16 +42,12 @@ def __init__(self, *args, **kwargs): self.fields["connection"].widget.attrs["class"] = "form-select" def clean(self): - if self.instance and self.data.get("created_by_user", None): + # Don't overwrite created_by_user + if self.instance and self.instance.created_by_user: self.cleaned_data["created_by_user"] = \ self.instance.created_by_user return super().clean() - @property - def created_by_user_email(self): - return self.instance.created_by_user.email if \ - self.instance.created_by_user else "--" - @property def created_at_time(self): return self.instance.created_at.strftime("%Y-%m-%d") diff --git a/explorer/templates/explorer/query.html b/explorer/templates/explorer/query.html index 180912f9..0d0276c5 100644 --- a/explorer/templates/explorer/query.html +++ b/explorer/templates/explorer/query.html @@ -62,7 +62,6 @@

{% trans "Description"%} - {% if form.sql.errors %} {% for error in form.sql.errors %}
{{ error|escape }}
@@ -142,8 +141,8 @@

{% if query.avg_duration %} - {% blocktrans trimmed with avg_duration_display=query.avg_duration_display user_email=form.created_by_user_email created=form.created_at_time %} - Avg. execution: {{ avg_duration_display }}ms. Query created by {{ user_email }} on {{ created }}. + {% blocktrans trimmed with avg_duration_display=query.avg_duration_display cuser=query.created_by_user created=form.created_at_time %} + Avg. execution: {{ avg_duration_display }}ms. Query created by {{ cuser }} on {{ created }}. {% endblocktrans %} {% if query %} {% trans "History" %}{% endif %} {% endif %}