<commit_before>{% extends "admin/change_form.html" %}
{% load i18n %}
{% load satchmo_product_admin %}

{% block after_related_objects %}
{% if original %}
{% orderpayment_list original %}
{% customproduct_management original %}
{% endif %}
{{ block.super }}
{% endblock %}

<commit_msg>Added javascript to show errors in inline form fields<commit_after>{% extends "admin/change_form.html" %}
{% load i18n %}
{% load satchmo_product_admin %}

{% block after_related_objects %}
{% if original %}
{% orderpayment_list original %}
{% customproduct_management original %}
{% endif %}
{{ block.super }}
{% endblock %}
{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{{media_url}}js/jquery.js"></script>
    <script type="text/javascript">
{% if form.error_dict %}
function satchmo_find(inputs, id) {
	for (var i=0; i<inputs.length; i++) { 
		var elt = inputs[i];
		if (elt.id == id) {
			return elt;
		}
	}
	return null;
}
function satchmo_update(inputs, id, msg) {
	var elt = satchmo_find(inputs, "id_" + id);
	if (elt) {
		$(elt).after("<span class='error'>**" + msg + "</span>");
	}
}
$(function() {
	var inputs = $('input');
	{% for key,msg in form.error_dict.items %}
	satchmo_update(inputs, "{{key}}", "{{msg.0}}");{% endfor %}
});
{% endif %}
</script>
{% endblock %}
{'fraction_non_alphanumeric': 0.19984567901234568, 'fraction_numerical': 0.004629629629629629, 'mean_word_length': 4.8954545454545455, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5213119', 'n_tokens_mistral': 503, 'n_tokens_neox': 441, 'n_words': 102}