fix(MR-16): Use cache for FileField and ImageField (#17)
* Remove casting to list in _get_form_data * Use cache for most fields and admin form for m2m files * MR comments/clean up * Cache should obey exclude and fields * Some more tests and docs * Only use cache for image files * Even more tests and handle save as new * fix test * More tests * minor refactor * Improve test coverage * Add no cover for some places * V0.2.3.dev7 * Adding tests for fieldsets * Added cache timeout * Added another test for an edge case * Fix issue with ManagementForm tampered with * Update cache to only set when form is_multipart * Even more testing changes * Update based on comments on MR and clean up a bit * make test names better Co-authored-by: Thu Trang Pham <thu@joinmodernhealth.com>
This commit is contained in:
@@ -31,27 +31,29 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if add %}
|
||||
<p>{% blocktrans with escaped_object=object %}Are you sure you want to add the {{ model_name }}?{% endblocktrans %}</p>
|
||||
{% include "admin/change_data.html" %}
|
||||
<form method="post" action="{% url opts|admin_urlname:'add'%}">{% csrf_token %}
|
||||
{% if add or save_as_new %}
|
||||
<p>{% blocktrans with escaped_object=object %}Are you sure you want to add the {{ model_name }}?{% endblocktrans %}</p>
|
||||
{% else %}
|
||||
<p>{% blocktrans with escaped_object=object %}Are you sure you want to change the {{ model_name }} "{{ object_name }}"?{% endblocktrans %}</p>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
<p>{% blocktrans with escaped_object=object %}Are you sure you want to change the {{ model_name }} "{{ object_name }}"?{% endblocktrans %}</p>
|
||||
{% include "admin/change_data.html" %}
|
||||
<form method="post" action="{% url opts|admin_urlname:'change' object_id|admin_urlquote %}">{% csrf_token %}
|
||||
{% endif %}
|
||||
<div class=hidden>
|
||||
{{ form }}
|
||||
</div>
|
||||
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
|
||||
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
|
||||
<div class="submit-row">
|
||||
<input type="submit" value="{% trans 'Yes, I’m sure' %}" name="{{ submit_name }}">
|
||||
<p class="deletelink-box">
|
||||
<a href="#" class="button cancel-link">{% trans "No, continue to edit" %}</a>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form {% if form.is_multipart %}enctype="multipart/form-data"{% endif %} method="post" {% if add %}action="{% url opts|admin_urlname:'add'%}" {% else %}action="{% url opts|admin_urlname:'change' object_id|admin_urlquote %}"{% endif %}>{% csrf_token %}
|
||||
<div class="hidden">
|
||||
{{form.as_p}}
|
||||
{% for formset in formsets %}
|
||||
{{ formset.as_p }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
|
||||
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
|
||||
{% if form.is_multipart %}<input type="hidden" name=CONFIRMATION_RECEIVED value="True">{% endif %}
|
||||
<div class="submit-row">
|
||||
<input type="submit" value="{% trans 'Yes, I’m sure' %}" name="{{ submit_name }}">
|
||||
<p class="deletelink-box">
|
||||
<a href="#" class="button cancel-link">{% trans "No, continue to edit" %}</a>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user