parent
9fe7370f26
commit
fa2d0a313a
15 changed files with 784 additions and 85 deletions
@ -1,30 +1,101 @@ |
||||
# -*- coding: utf-8 -*- |
||||
from django.views.generic import CreateView, UpdateView, DeleteView, ListView, DetailView |
||||
from .forms import * |
||||
from django.core.urlresolvers import reverse |
||||
from django.core.urlresolvers import reverse_lazy |
||||
from django.conf import settings |
||||
from django.shortcuts import get_object_or_404 |
||||
|
||||
|
||||
class SpecialistCreateView(CreateView): |
||||
form_class = SpecialistForm |
||||
model = Specialist |
||||
template_name = 'admin/specialist/specialist_new.html' |
||||
success_url = reverse("specialist_all") |
||||
success_url = reverse_lazy("specialist_all") |
||||
|
||||
|
||||
class SpecialistListView(ListView): |
||||
model = Specialist |
||||
template_name = 'admin/specialist/specialist_all.html' |
||||
paginate_by = settings.ADMIN_PAGINATION |
||||
|
||||
|
||||
class SpecialistUpdateView(UpdateView): |
||||
form_class = SpecialistForm |
||||
model = Specialist |
||||
template_name = 'admin/specialist/specialist_new.html' |
||||
success_url = reverse("specialist_all") |
||||
success_url = reverse_lazy("specialist_all") |
||||
|
||||
def get_form(self, form_class): |
||||
form = super(SpecialistUpdateView, self).get_form(form_class) |
||||
form.fields['city'].widget.attrs['data-init-text'] = self.object.city.name |
||||
return form |
||||
|
||||
|
||||
class SpecialistDeleteView(DeleteView): |
||||
model = Specialist |
||||
template_name = 'admin/specialist/specialist_confirm_delete.html' |
||||
success_url = reverse("specialist_all") |
||||
success_url = reverse_lazy("specialist_all") |
||||
|
||||
|
||||
class CatalogCreateView(CreateView): |
||||
form_class = SpecialistCatalogForm |
||||
model = SpecialistCatalog |
||||
template_name = 'admin/specialist/catalog_new.html' |
||||
success_url = reverse_lazy("catalog_all") |
||||
|
||||
|
||||
class CatalogListView(ListView): |
||||
model = SpecialistCatalog |
||||
template_name = 'admin/specialist/catalog_all.html' |
||||
paginate_by = settings.ADMIN_PAGINATION |
||||
|
||||
|
||||
class CatalogUpdateView(UpdateView): |
||||
form_class = SpecialistCatalogForm |
||||
model = SpecialistCatalog |
||||
template_name = 'admin/specialist/catalog_new.html' |
||||
success_url = reverse_lazy("catalog_all") |
||||
|
||||
def get_form(self, form_class): |
||||
form = super(CatalogUpdateView, self).get_form(form_class) |
||||
if self.object.type is 2: # city |
||||
form.fields['city'].widget.attrs['data-init-text'] = self.object.city.name |
||||
return form |
||||
|
||||
|
||||
class CatalogDeleteView(DeleteView): |
||||
model = SpecialistCatalog |
||||
template_name = 'admin/specialist/catalog_confirm_delete.html' |
||||
success_url = reverse_lazy("catalog_all") |
||||
|
||||
|
||||
class FeedbackCreateView(CreateView): |
||||
form_class = FeedbackForm |
||||
model = Feedback |
||||
template_name = 'admin/specialist/feedback_new.html' |
||||
success_url = reverse_lazy("catalog_all") |
||||
|
||||
def get_initial(self): |
||||
catalog = get_object_or_404(SpecialistCatalog, pk=self.kwargs.get('pk')) |
||||
return {'catalog': catalog} |
||||
|
||||
# class FeedbackListView(ListView): |
||||
# model = Feedback |
||||
# template_name = 'admin/specialist/feedback_all.html' |
||||
# paginate_by = settings.ADMIN_PAGINATION |
||||
|
||||
|
||||
class FeedbackUpdateView(UpdateView): |
||||
form_class = FeedbackForm |
||||
model = Feedback |
||||
template_name = 'admin/specialist/feedback_new.html' |
||||
success_url = reverse_lazy("catalog_all") |
||||
|
||||
def get_initial(self): |
||||
catalog = get_object_or_404(SpecialistCatalog, pk=self.kwargs.get('id')) |
||||
return {'catalog': catalog} |
||||
|
||||
class FeedbackDeleteView(DeleteView): |
||||
model = Feedback |
||||
template_name = 'admin/specialist/feedback_confirm_delete.html' |
||||
success_url = reverse_lazy("catalog_all") |
||||
|
||||
@ -0,0 +1,93 @@ |
||||
/** |
||||
* Created by dev on 07.09.2015. |
||||
*/ |
||||
$(document).ready(function () { |
||||
$('select').select2({ |
||||
width: 'element', |
||||
allowClear: true |
||||
}); |
||||
|
||||
$('#id_country').change(function () { |
||||
$.get( |
||||
"/admin/ajax_city/", {'id': $(this).val()}, function (j) { |
||||
|
||||
$('#id_city').html(j); |
||||
$('#id_city').attr('disabled', false); |
||||
|
||||
}); |
||||
}); |
||||
|
||||
|
||||
$('#id_city').select2({ |
||||
placeholder: "Город", |
||||
width: 300, |
||||
ajax: { |
||||
|
||||
url: "/admin/city/search/", |
||||
dataType: "json", |
||||
quietMillis: 200, |
||||
|
||||
data: function (term, page, country) { |
||||
var country = $('#id_country').val(); |
||||
return { |
||||
term: term, |
||||
page: page, |
||||
country: country |
||||
}; |
||||
}, |
||||
|
||||
results: function (data) { |
||||
var results = []; |
||||
$.each(data, function (index, item) { |
||||
results.push({ |
||||
id: item.id, |
||||
text: item.label |
||||
}); |
||||
}); |
||||
return {results: results}; |
||||
} |
||||
}, |
||||
initSelection: function (element, callback) { |
||||
var id = $(element).val(); |
||||
var text = $(element).attr('data-init-text'); |
||||
callback({id: id, text: text}); |
||||
|
||||
} |
||||
|
||||
}); |
||||
|
||||
|
||||
// displaying uploaded photo
|
||||
|
||||
function handleFileSelect(evt) { |
||||
var files = evt.target.files; // FileList object
|
||||
|
||||
// Loop through the FileList and render image files as thumbnails.
|
||||
for (var i = 0, f; f = files[i]; i++) { |
||||
|
||||
// Only process image files.
|
||||
if (!f.type.match('image.*')) { |
||||
continue; |
||||
} |
||||
|
||||
var reader = new FileReader(); |
||||
|
||||
// Closure to capture the file information.
|
||||
|
||||
reader.onload = (function (theFile) { |
||||
return function (e) { |
||||
document.getElementById('list').innerHTML = ['<img class="thumb" src="', |
||||
e.target.result, '" title="', escape(theFile.name), '"/>'].join(''); |
||||
}; |
||||
})(f); |
||||
|
||||
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsDataURL(f); |
||||
} |
||||
} |
||||
|
||||
document.getElementById('id_photo').addEventListener('change', handleFileSelect, false); |
||||
document.getElementById('id_logo').addEventListener('change', handleFileSelect, false); |
||||
console.log("hello from new specialist view.js"); |
||||
}); |
||||
@ -0,0 +1,120 @@ |
||||
/** |
||||
* Created by dev on 07.09.2015. |
||||
*/ |
||||
$(document).ready(function () { |
||||
$('select').select2({ |
||||
width: 'element', |
||||
allowClear: true |
||||
}); |
||||
|
||||
$('#id_country').change(function () { |
||||
$.get( |
||||
"/admin/ajax_city/", {'id': $(this).val()}, function (j) { |
||||
|
||||
$('#id_city').html(j); |
||||
$('#id_city').attr('disabled', false); |
||||
|
||||
}); |
||||
}); |
||||
|
||||
|
||||
$('#id_city').select2({ |
||||
placeholder: "Город", |
||||
width: 300, |
||||
ajax: { |
||||
|
||||
url: "/admin/city/search/", |
||||
dataType: "json", |
||||
quietMillis: 200, |
||||
|
||||
data: function (term, page, country) { |
||||
var country = $('#id_country').val(); |
||||
return { |
||||
term: term, |
||||
page: page, |
||||
country: country |
||||
}; |
||||
}, |
||||
|
||||
results: function (data) { |
||||
var results = []; |
||||
$.each(data, function (index, item) { |
||||
results.push({ |
||||
id: item.id, |
||||
text: item.label |
||||
}); |
||||
}); |
||||
return {results: results}; |
||||
} |
||||
}, |
||||
initSelection: function (element, callback) { |
||||
var id = $(element).val(); |
||||
var text = $(element).attr('data-init-text'); |
||||
callback({id: id, text: text}); |
||||
|
||||
} |
||||
|
||||
}); |
||||
|
||||
|
||||
// displaying uploaded photo
|
||||
|
||||
function handleFileSelect1(evt) { |
||||
var files = evt.target.files; // FileList object
|
||||
|
||||
// Loop through the FileList and render image files as thumbnails.
|
||||
for (var i = 0, f; f = files[i]; i++) { |
||||
|
||||
// Only process image files.
|
||||
if (!f.type.match('image.*')) { |
||||
continue; |
||||
} |
||||
|
||||
var reader = new FileReader(); |
||||
|
||||
// Closure to capture the file information.
|
||||
|
||||
reader.onload = (function (theFile) { |
||||
return function (e) { |
||||
document.getElementById('list_picture').innerHTML = ['<img class="thumb" src="', |
||||
e.target.result, '" title="', escape(theFile.name), '"/>'].join(''); |
||||
}; |
||||
})(f); |
||||
|
||||
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsDataURL(f); |
||||
} |
||||
} |
||||
function handleFileSelect2(evt) { |
||||
var files = evt.target.files; // FileList object
|
||||
|
||||
// Loop through the FileList and render image files as thumbnails.
|
||||
for (var i = 0, f; f = files[i]; i++) { |
||||
|
||||
// Only process image files.
|
||||
if (!f.type.match('image.*')) { |
||||
continue; |
||||
} |
||||
|
||||
var reader = new FileReader(); |
||||
|
||||
// Closure to capture the file information.
|
||||
|
||||
reader.onload = (function (theFile) { |
||||
return function (e) { |
||||
document.getElementById('list_logo').innerHTML = ['<img class="thumb" src="', |
||||
e.target.result, '" title="', escape(theFile.name), '"/>'].join(''); |
||||
}; |
||||
})(f); |
||||
|
||||
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsDataURL(f); |
||||
} |
||||
} |
||||
|
||||
document.getElementById('id_place_photo').addEventListener('change', handleFileSelect1, false); |
||||
document.getElementById('id_logo_preview').addEventListener('change', handleFileSelect2, false); |
||||
console.log("hello from new catalog view.js"); |
||||
}); |
||||
@ -0,0 +1,62 @@ |
||||
{% extends 'base.html' %} |
||||
{% load thumbnail %} |
||||
{% block body %} |
||||
<div class="box span8"> |
||||
<div class="box-header well"> |
||||
<h2><i class="icon-arrow-down"></i>Все каталоги специалистов</h2> |
||||
</div> |
||||
<div class="box-content"> |
||||
<table class="table table-hover"> |
||||
<thead> |
||||
<tr> |
||||
|
||||
<th> </th> |
||||
<th>Заголовок</th> |
||||
<th>Тип</th> |
||||
<th>Количество специалистов</th> |
||||
<th> </th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for item in object_list %} |
||||
<tr> |
||||
|
||||
<td> |
||||
{% thumbnail item.logo_preview "100x100" crop="center" as im %} |
||||
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"> |
||||
{% endthumbnail %}</td> |
||||
<td>{{ item.title }}</td> |
||||
<td>{% if item.type == 1%}Страна{% else %}Город{% endif %}</td> |
||||
<td>{{ item.specialists.count }}</td> |
||||
<td class="center sorting_1"> |
||||
<a class="btn-small btn-info" href='{% url "catalog_edit" item.id %}'> |
||||
Изменить |
||||
</a> |
||||
</td> |
||||
|
||||
<td> |
||||
<a class="btn-small btn-danger delete" href='{% url "catalog_delete" item.id %}'> |
||||
Удалить |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
<a class="btn btn-success" href='{% url "catalog_new" %}'> |
||||
<i class="icon-plus-sign icon-white"></i> Хочу еще один </a> |
||||
</div> |
||||
|
||||
<div class="pagination pagination-centered"> |
||||
<ul> |
||||
{% if page_obj.has_previous %} |
||||
<li> <a href="?page={{ page_obj.previous_page_number }}">←</a></li> |
||||
{% endif %} |
||||
|
||||
{% if page_obj.has_next %} |
||||
<li><a href="?page={{ page_obj.next_page_number }}">→</a></li> |
||||
{% endif %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
{% endblock %} |
||||
@ -0,0 +1,11 @@ |
||||
{% extends 'base.html' %} |
||||
{% block sidebar %}{% endblock %} |
||||
{% block body %} |
||||
<form action="" method="post">{% csrf_token %} |
||||
<div class="controls"> |
||||
<p>Вы точно хотите удалить "{{ object.title }}" ?</p> |
||||
<input class="btn btn-large btn-danger delete" type="submit" value="Да" /> |
||||
<a class="btn btn-large btn-primary" href = {% url 'catalog_all' %}>Нет</a> |
||||
</div> |
||||
</form> |
||||
{% endblock %} |
||||
@ -0,0 +1,195 @@ |
||||
{% extends 'base.html' %} |
||||
{% load thumbnail %} |
||||
{% load static %} |
||||
{# Displays article form #} |
||||
|
||||
{% block scripts %} |
||||
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script> |
||||
{# selects for city and country #} |
||||
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/> |
||||
<style> |
||||
.thumb { |
||||
height: 75px; |
||||
border: 1px solid #000; |
||||
margin: 10px 5px 0 0; |
||||
} |
||||
</style> |
||||
<script src="{% static 'js/select/select2.js' %}"></script> |
||||
<script src="{% static 'custom_js/specialist_catalog.js' %}"></script> |
||||
{% endblock %} |
||||
|
||||
{% block body %} |
||||
<form method="post" class="form-horizontal" enctype="multipart/form-data"> {% csrf_token %} |
||||
<fieldset> |
||||
<div class="box span8"> |
||||
<div class="box-header well"> |
||||
<h2><i class="icon-pencil"></i> Добавление каталога специалистов(переводчиков)</h2> |
||||
</div> |
||||
<div class="box-content"> |
||||
{# title #} |
||||
<div class="control-group {% if form.title.errors %}error{% endif %}"> |
||||
<label class="control-label"><b>{{ form.title.label }}:</b></label> |
||||
<div class="controls"> |
||||
{{ form.title }}<span class="help-inline"></span> |
||||
<span class="help-inline">{{ form.title.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# main_descr #} |
||||
<div class="control-group {% if form.main_descr.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.main_descr.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.main_descr }} |
||||
<span class="help-inline">{{ form.main_descr.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
{# benefits #} |
||||
<div class="control-group {% if form.benefits.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.benefits.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.benefits }} |
||||
<span class="help-inline">{{ form.benefits.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
{# price #} |
||||
<div class="control-group {% if form.price.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.price.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.price }}{{ form.currency.label }}{{ form.currency }} |
||||
<span class="help-inline">{{ form.price.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
{# type #} |
||||
<div class="control-group {% if form.type.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.type.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.type }} |
||||
<span class="help-inline">{{ form.type.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
{# country #} |
||||
<div class="control-group {% if form.country.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.country.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.country }} |
||||
<span class="help-inline">{{ form.country.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# city #} |
||||
<div class="control-group {% if form.city.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.city.label }}(не обязательно):</label> |
||||
<div class="controls"> |
||||
{{ form.city }} |
||||
<span class="help-inline">{{ form.city.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
{# specialists #} |
||||
<div class="control-group {% if form.specialists.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.specialists.label }}(не обязательно):</label> |
||||
<div class="controls"> |
||||
{{ form.specialists }}<a class="btn " href="{% url 'specialist_new' %}">Довавить</a> |
||||
<span class="help-inline">{{ form.specialists.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# logo_preview #} |
||||
<div class="control-group {% if form.logo_preview.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.logo_preview.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.logo_preview }} <output id="list_logo"></output> |
||||
<span class="help-inline">{{ form.logo_preview.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# place_photo #} |
||||
<div class="control-group {% if form.place_photo.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.place_photo.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.place_photo }} <output id="list_picture"></output> |
||||
<span class="help-inline">{{ form.place_photo.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
<div class="controls"> |
||||
|
||||
<input class="btn btn-large btn-primary" type="submit" {% if request.path == '/admin/specialist_catalog/catalog/new/' %} value="Добавить" {% else %} value='Изменить' {% endif %}/> |
||||
<input class="btn btn-large" type="reset" value="Отмена"> |
||||
<a class="btn btn-large" href="{% url 'catalog_all' %}">Чет передумал(а)</a> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
|
||||
<!--Feedbacks block --> |
||||
{% if object.feedback_set.all %} |
||||
{% with object.feedback_set.all as feedbacks %} |
||||
|
||||
<div class="box span8"> |
||||
<div class="box-header well"> |
||||
<h2><i class="icon-arrow-down"></i>Отзывы для текущего каталога </h2> |
||||
</div> |
||||
<div class="box-content"> |
||||
<table class="table table-hover"> |
||||
<thead> |
||||
<tr> |
||||
|
||||
<th>Логотип</th> |
||||
<th>Имя</th> |
||||
<th>Компания</th> |
||||
<th>Текст</th> |
||||
<th> </th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for item in feedbacks %} |
||||
<tr> |
||||
|
||||
<td> |
||||
{% thumbnail item.logo "100x100" crop="center" as im %} |
||||
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"> |
||||
{% endthumbnail %}</td> |
||||
<td>{{ item.name }}</td> |
||||
<td>{{ item.company }}</td> |
||||
<td>{{ item.text }}</td> |
||||
<td class="center sorting_1"> |
||||
<a class="btn-small btn-info" href='{% url "feedback_edit" pk=object.id id=item.id %}'> |
||||
Изменить |
||||
</a> |
||||
</td> |
||||
|
||||
<td> |
||||
<a class="btn-small btn-danger delete" href='{% url "feedback_delete" item.id %}'> |
||||
Удалить |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
<a class="btn btn-success" href='{% url "feedback_new" object.id %}'> |
||||
<i class="icon-plus-sign icon-white"></i> Хочу еще один </a> |
||||
</div> |
||||
|
||||
<div class="pagination pagination-centered"> |
||||
<ul> |
||||
{% if page_obj.has_previous %} |
||||
<li><a href="?page={{ page_obj.previous_page_number }}">←</a></li> |
||||
{% endif %} |
||||
|
||||
{% if page_obj.has_next %} |
||||
<li><a href="?page={{ page_obj.next_page_number }}">→</a></li> |
||||
{% endif %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
{% endwith %} |
||||
{% elif object.id %} |
||||
Отзывов еще нет, |
||||
<a class="btn btn-success" href='{% url "feedback_new" pk=object.id%}'> |
||||
<i class="icon-plus-sign icon-white"></i> Добавить </a> |
||||
{% endif %} |
||||
{% endblock %} |
||||
@ -0,0 +1,62 @@ |
||||
{% extends 'base.html' %} |
||||
{% load thumbnail %} |
||||
{% block body %} |
||||
<div class="box span8"> |
||||
<div class="box-header well"> |
||||
<h2><i class="icon-arrow-down"></i>Отзывы для %(calatolog)</h2> |
||||
</div> |
||||
<div class="box-content"> |
||||
<table class="table table-hover"> |
||||
<thead> |
||||
<tr> |
||||
|
||||
<th>Логотип </th> |
||||
<th>Имя</th> |
||||
<th>Компания</th> |
||||
<th>Текст</th> |
||||
<th> </th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for item in object_list %} |
||||
<tr> |
||||
|
||||
<td> |
||||
{% thumbnail item.logo "100x100" crop="center" as im %} |
||||
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"> |
||||
{% endthumbnail %}</td> |
||||
<td>{{ item.name }}</td> |
||||
<td>{{ item.company }}</td> |
||||
<td>{{ item.text }}</td> |
||||
<td class="center sorting_1"> |
||||
<a class="btn-small btn-info" href='{% url "feedback_edit" item.id %}'> |
||||
Изменить |
||||
</a> |
||||
</td> |
||||
|
||||
<td> |
||||
<a class="btn-small btn-danger delete" href='{% url "feedback_delete" item.id %}'> |
||||
Удалить |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
<a class="btn btn-success" href='{% url "feedback_new" %}'> |
||||
<i class="icon-plus-sign icon-white"></i> Хочу еще один </a> |
||||
</div> |
||||
|
||||
<div class="pagination pagination-centered"> |
||||
<ul> |
||||
{% if page_obj.has_previous %} |
||||
<li> <a href="?page={{ page_obj.previous_page_number }}">←</a></li> |
||||
{% endif %} |
||||
|
||||
{% if page_obj.has_next %} |
||||
<li><a href="?page={{ page_obj.next_page_number }}">→</a></li> |
||||
{% endif %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
{% endblock %} |
||||
@ -0,0 +1,11 @@ |
||||
{% extends 'base.html' %} |
||||
{% block sidebar %}{% endblock %} |
||||
{% block body %} |
||||
<form action="" method="post">{% csrf_token %} |
||||
<div class="controls"> |
||||
<p>Вы точно хотите удалить "{{ object.name }}" ?</p> |
||||
<input class="btn btn-large btn-danger delete" type="submit" value="Да" /> |
||||
<a class="btn btn-large btn-primary" href = {% url 'catalog_all' %}>Нет</a> |
||||
</div> |
||||
</form> |
||||
{% endblock %} |
||||
@ -0,0 +1,79 @@ |
||||
{% extends 'base.html' %} |
||||
{% load static %} |
||||
{# Displays article form #} |
||||
|
||||
{% block scripts %} |
||||
{# selects for city and country #} |
||||
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/> |
||||
<style> |
||||
.thumb { |
||||
height: 75px; |
||||
border: 1px solid #000; |
||||
margin: 10px 5px 0 0; |
||||
} |
||||
</style> |
||||
<script src="{% static 'js/select/select2.js' %}"></script> |
||||
<script src="{% static 'custom_js/specialist.js' %}?ad=ddd"></script> |
||||
{% endblock %} |
||||
|
||||
{% block body %} |
||||
<form method="post" class="form-horizontal" enctype="multipart/form-data"> {% csrf_token %} |
||||
<fieldset> |
||||
<div class="box span8"> |
||||
<div class="box-header well"> |
||||
<h2><i class="icon-pencil"></i> Добавление отз ва</h2> |
||||
</div> |
||||
<div class="box-content"> |
||||
{# name #} |
||||
<div class="control-group {% if form.name.errors %}error{% endif %}"> |
||||
<label class="control-label"><b>{{ form.name.label }}:</b></label> |
||||
<div class="controls"> |
||||
{{ form.name }}<span class="help-inline"></span> |
||||
<span class="help-inline">{{ form.name.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# company #} |
||||
<div class="control-group {% if form.company.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.company.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.company }} |
||||
<span class="help-inline">{{ form.company.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# text #} |
||||
<div class="control-group {% if form.text.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.text.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.text }} |
||||
<span class="help-inline">{{ form.text.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# catalog #} |
||||
<div class="control-group {% if form.catalog.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.catalog.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.catalog }} |
||||
<span class="help-inline">{{ form.catalog.errors }}</span> |
||||
</div> |
||||
</div> |
||||
{# logo #} |
||||
<div class="control-group {% if form.logo.errors %}error{% endif %}"> |
||||
<label class="control-label">{{ form.logo.label }}:</label> |
||||
<div class="controls"> |
||||
{{ form.logo }} <output id="list"></output> |
||||
<span class="help-inline">{{ form.logo.errors }}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
<div class="controls"> |
||||
|
||||
<input class="btn btn-large btn-primary" type="submit" value="Добавить/Изменить" /> |
||||
<input class="btn btn-large" type="reset" value="Отмена"> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
|
||||
{% endblock %} |
||||
Loading…
Reference in new issue