{% extends "layout2.html" %} {% load i18n %} {% load static %} {% block css_include %} {% endblock %} {% block js_include %} {% endblock %} {% block content %}
{% csrf_token %}
{% if form.non_field_errors %}
{# Print form errors correctly #}

Form errors

{{ form.non_field_errors|safe }}
{% endif %}

 {% translate "OTP Repository edition" %}

{{form.name}} {{form.name.errors|safe}}
{{form.otp_type}} {{form.otp_type.errors|safe}}
{{form.api_key}} {{form.api_key.errors|safe}}
{{form.otp_phone_service}} {{form.otp_phone_service.errors|safe}}
{{form.totp_label}} {{form.totp_label.errors|safe}}
{% endblock %} {% block jquery_code %} if (!String.prototype.endsWith) { String.prototype.endsWith = function(searchString, position) { var subjectString = this.toString(); if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.lastIndexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }; } /* Initialize select2 objects */ $('.select2').select2(); /* Switchery mandatory code */ var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch')); elems.forEach(function(html) { var switchery = new Switchery(html, { 'color': '#FA9834', }); }); /* Change fields showing according to chosen type */ function otp_type_handle(e) { var otp_type = $('#id_otp_type').val(); for( mode of $('#id_otp_type')[0].options ) { $('.'+mode.value).hide(); } $('.'+otp_type).show(); } $('#id_otp_type').on("change", otp_type_handle); otp_type_handle(); //}); // end of function() {% endblock %}