Skip to content

Commit

Permalink
no email required (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisclark authored Apr 22, 2024
1 parent 71f5ddb commit 86bc056
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
8 changes: 2 additions & 6 deletions explorer/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 2 additions & 3 deletions explorer/templates/explorer/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ <h2>
{% trans "Description"%}
</label>
</div>
<input type="hidden" id="id_created_by_user" name="created_by_user" value="{{ form.created_by_user_email }}" />
{% if form.sql.errors %}
{% for error in form.sql.errors %}
<div class="alert alert-danger">{{ error|escape }}</div>
Expand Down Expand Up @@ -142,8 +141,8 @@ <h2>

<div class="container mt-1 text-end small">
{% 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 %}<a href="{% url 'explorer_logs' %}?query_id={{ query.id }}"> {% trans "History" %}</a>{% endif %}
{% endif %}
Expand Down

0 comments on commit 86bc056

Please sign in to comment.