{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load custom_tags %}

{% block title %}{% trans 'New' %} - {{ title }}{% endblock %}

{% block extra_head %}
    {{ form.media }}
{% endblock %}

{% block content %}

    <h3>{% trans 'New' %} {{ title }} </h3>

    {% if form.Meta.model|get_class_name == 'Storage' %}
        {% include 'include/storage_backend_warning.html' %}
    {% endif %}

    <form action="." method="post">
        {% csrf_token %}
        {{ form|crispy }}
        <button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
    </form>

    {% if default_recipe %}
        <script type="text/javascript">

            $(document).ready(function () {
                $('#id_recipe').val({{ default_recipe.pk }}).trigger('change');
            });

        </script>
    {% endif %}


{% endblock %}