<commit_before>{% extends "admin/product/change_form.html" %}
{% load i18n %}
{% block extrahead %}
{{block.super}}
{% comment %}
jquery script should've already been added in admin/product/change_form.html, so don't add it again here
{% endcomment %}
<script type="text/javascript">
function setOptions(data){
    options_tag = $("select#id_options");
    options_tag.html(data);
    // at this point all the options end-up being selected,

    //So, unselect them all
    for (opt_tag in options_tag.children()){
        opt_tag = options_tag.children()[opt_tag];
        opt_tag.selected = false;
    }
    //Then if any were specified as selected, reselect them
    selected_options = new Array({{form.data.options|join:","}});
    for (sel_opt in selected_options){
        sel_opt = selected_options[sel_opt];
        for (opt_tag in options_tag.children()){
            opt_tag = options_tag.children()[opt_tag];
            if (opt_tag.value == sel_opt){
                opt_tag.selected = true;
            }
        }
    }
}
function getOptions(){
    parent_tag = $("*#id_parent");
    parent_id = parent_tag.attr("value");
    $.get("../../configurableproduct/" + parent_id + "/getoptions/", setOptions );
}

$(document).ready(function(){
    parent_tag = $("*#id_parent");
    parent_tag.change(getOptions);

    parent_value = parent_tag.attr("value");
    if (parent_value){
        getOptions();
    }

{% if original %}
    //letting the user change the parent on an existing ProductVariation
    //will just confuse things, and probably never makes sense.
    $("*#id_parent").attr("disabled", "true");
{% endif %}

});

</script>
{% endblock %}

{% block after_related_objects %}
{% if original %}
<fieldset class="module">
<h2>{% trans "Helpers" %}</h2>
<ul><li><a href="{% url satchmo_admin_variation_manager original.slug %}">{% trans "Variation Manager" %}</a></li></ul>
</fieldset>
{% endif %}
{{ block.super }}
{% endblock %}<commit_msg>Fix a template error in the admin change form.<commit_after>{% extends "admin/product/change_form.html" %}
{% load i18n %}
{% block extrahead %}
{{block.super}}
{% comment %}
jquery script should've already been added in admin/product/change_form.html, so don't add it again here
{% endcomment %}
<script type="text/javascript">
function setOptions(data){
    options_tag = $("select#id_options");
    options_tag.html(data);
    // at this point all the options end-up being selected,

    //So, unselect them all
    for (opt_tag in options_tag.children()){
        opt_tag = options_tag.children()[opt_tag];
        opt_tag.selected = false;
    }
    //Then if any were specified as selected, reselect them
    selected_options = new Array({{form.data.options|join:","}});
    for (sel_opt in selected_options){
        sel_opt = selected_options[sel_opt];
        for (opt_tag in options_tag.children()){
            opt_tag = options_tag.children()[opt_tag];
            if (opt_tag.value == sel_opt){
                opt_tag.selected = true;
            }
        }
    }
}
function getOptions(){
    parent_tag = $("*#id_parent");
    parent_id = parent_tag.attr("value");
    $.get("../../configurableproduct/" + parent_id + "/getoptions/", setOptions );
}

$(document).ready(function(){
    parent_tag = $("*#id_parent");
    parent_tag.change(getOptions);

    parent_value = parent_tag.attr("value");
    if (parent_value){
        getOptions();
    }

{% if original %}
    //letting the user change the parent on an existing ProductVariation
    //will just confuse things, and probably never makes sense.
    $("*#id_parent").attr("disabled", "true");
{% endif %}

});

</script>
{% endblock %}

{% block after_related_objects %}
{% if original %}
<fieldset class="module">
<h2>{% trans "Helpers" %}</h2>
<ul><li><a href="{% url satchmo_admin_variation_manager original %}">{% trans "Variation Manager" %}</a></li></ul>
</fieldset>
{% endif %}
{{ block.super }}
{% endblock %}
{'fraction_non_alphanumeric': 0.16186140617096612, 'fraction_numerical': 0.0020232675771370764, 'mean_word_length': 3.4288913773796192, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '981382', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1213, 'n_words': 306}