1 {% extends "catalogue/base.html" %}
4 {% block titleextra %}{% trans "Add image" %}{% endblock %}
10 var radio_buttons = $('input[type=radio][name=upload_type]'),
11 image_fields = $('.upload_type input[type=text],input[type=file]');
13 var enable_image_field = function(field) {
14 field.attr('disabled', false);
16 disable_image_fields = function() {
17 image_fields.attr('disabled', true);
20 radio_buttons.change(function() {
21 var radio_button = $(this),
22 related_image_field = $('#'+radio_button.attr('data-for'));
23 disable_image_fields();
24 enable_image_field(related_image_field);
28 disable_image_fields();
29 enable_image_field($('#id_download_url'));
35 <h1>{% trans "Add image" %}</h1>
38 <form method="post">{% csrf_token %}
39 <input type="hidden" name='form_id' value="flickr" />
40 <table class='editable'><tbody>
42 <tr><td></td><td><button type="submit">{% trans "Load from Flickr" %}</button></td></tr>
46 <form method="post" enctype="multipart/form-data">{% csrf_token %}
47 {{ form.non_field_errors }}
48 <table class='editable'><tbody>
49 {% for field in form %}
50 {% if field.name != 'download_url' and field.name != 'file' %}
52 <th>{{field.errors}} {{field.label}}</th>
57 <tr class="upload_type">
58 <th>{{ form.download_url.errors }} <input style="width: auto;" checked data-for="id_download_url" type="radio" name="upload_type" value="url"/>{{form.download_url.label}}</th>
59 <td>{{form.download_url}}</td>
60 <th>{{ form.file.errors }} <input style="width: auto;" data-for="id_file" type="radio" name="upload_type" value="file"/> Lub {{form.file.label}}</th>
61 <td>{{form.file}}</td>
64 <tr><td></td><td><button type="submit">{% trans "Add image" %}</button></td></tr>