lots of cleanup and refactoring

This commit is contained in:
vabene1111
2019-11-14 18:28:50 +01:00
parent 2e313f6be4
commit a3da7c2ffd
14 changed files with 154 additions and 109 deletions

View File

@@ -13,22 +13,19 @@
<h3>{% trans 'Edit' %} {{ title }}</h3>
{% if form.Meta.model|get_class == 'Storage' %} <!-- TODO make one include for this text block -->
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading"><i class="far fa-exclamation-triangle"></i> {% trans 'Security Warning' %}</h4>
<p>{% blocktrans %}
The <b>Password and Token</b> field are stored as <b>plain text</b> inside the database.
This is necessary because they are needed to make API requests, but it also increases the risk of someone stealing it. <br/>
To limit the possible damage use read only tokens or accounts if available or create separate accounts with limited access (only to recipes).
{% endblocktrans %}</p>
</div>
{% if form.Meta.model|get_class == 'Storage' %}
{% include 'include/storage_backend_warning.html' %}
{% endif %}
<form action="." method="post">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-success">
<a href="{% url 'redirect_delete' form.instance|get_class|lower form.instance.pk %}" class="btn btn-danger">{% trans 'Delete' %}</a>
<a href="{% url 'redirect_delete' form.instance|get_class|lower form.instance.pk %}"
class="btn btn-danger">{% trans 'Delete' %}</a>
{% if view_url %}
<a href="{{ view_url }}" class="btn btn-info">{% trans 'View' %} <i class="far fa-eye"></i></a>
{% endif %}
</form>
{% endblock %}

View File

@@ -23,7 +23,6 @@
{% render_table table %}
</div>
{% endblock content %}

View File

@@ -13,15 +13,8 @@
<h3>{% trans 'New' %} {{ title }} </h3>
{% if form.Meta.model|get_class == 'Storage' %} <!-- TODO make one include for this text block -->
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading"><i class="far fa-exclamation-triangle"></i> {% trans 'Security Warning' %}</h4>
<p>{% blocktrans %}
The <b>Password and Token</b> field are stored as <b>plain text</b> inside the database.
This is necessary because they are needed to make API requests, but it also increases the risk of someone stealing it. <br/>
To limit the possible damage use read only tokens or accounts if available or create separate accounts with limited access (only to recipes).
{% endblocktrans %}</p>
</div>
{% if form.Meta.model|get_class == 'Storage' %}
{% include 'include/storage_backend_warning.html' %}
{% endif %}
<form action="." method="post">

View File

@@ -1,10 +1,10 @@
{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}
{% block content %}
<div class="table-container">
{% block table %}
<table {% render_attrs table.attrs class="table" %}>