added views, urls and templates for specialist catalog and feedback

remotes/origin/1203
Ivan Kovalkovskyi 11 years ago
parent 9fe7370f26
commit fa2d0a313a
  1. 11
      specialist_catalog/admin_urls.py
  2. 31
      specialist_catalog/forms.py
  3. 9
      specialist_catalog/models.py
  4. 79
      specialist_catalog/views.py
  5. 93
      static/custom_js/specialist.js
  6. 120
      static/custom_js/specialist_catalog.js
  7. 62
      templates/admin/specialist/catalog_all.html
  8. 11
      templates/admin/specialist/catalog_confirm_delete.html
  9. 195
      templates/admin/specialist/catalog_new.html
  10. 62
      templates/admin/specialist/feedback_all.html
  11. 11
      templates/admin/specialist/feedback_confirm_delete.html
  12. 79
      templates/admin/specialist/feedback_new.html
  13. 22
      templates/admin/specialist/specialist_all.html
  14. 4
      templates/admin/specialist/specialist_confirm_delete.html
  15. 80
      templates/admin/specialist/specialist_new.html

@ -2,10 +2,17 @@
from django.conf.urls import url, patterns from django.conf.urls import url, patterns
from .views import * from .views import *
urlpaterns = patterns('', urlpatterns = patterns('',
url(r'^specialist/new/$', SpecialistCreateView.as_view(), name='specialist_new'), url(r'^specialist/new/$', SpecialistCreateView.as_view(), name='specialist_new'),
url(r'^specialist/all/$', SpecialistListView.as_view(), name='specialist_all'), url(r'^specialist/all/$', SpecialistListView.as_view(), name='specialist_all'),
url(r'^specialist/edit/(?P<pk>\d{1,4})/$', SpecialistUpdateView.as_view(), name='specialist_edit'), url(r'^specialist/edit/(?P<pk>\d{1,4})/$', SpecialistUpdateView.as_view(), name='specialist_edit'),
url(r'^specialist/delete/(?P<pk>\d{1,4})/$', SpecialistDeleteView.as_view(), name='specialist_delete'), url(r'^specialist/delete/(?P<pk>\d{1,4})/$', SpecialistDeleteView.as_view(), name='specialist_delete'),
url(r'^catalog/new/$', CatalogCreateView.as_view(), name='catalog_new'),
url(r'^catalog/all/$', CatalogListView.as_view(), name='catalog_all'),
url(r'^catalog/edit/(?P<pk>\d{1,4})/$', CatalogUpdateView.as_view(), name='catalog_edit'),
url(r'^catalog/delete/(?P<pk>\d{1,4})/$', CatalogDeleteView.as_view(), name='catalog_delete'),
url(r'^catalog/(?P<pk>\d{1,4})/add_feedback/$', FeedbackCreateView.as_view(), name='feedback_new'),
#url(r'^catalog/(?P<pk>\d{1,4})/feedbacks/$', FeedbackListView.as_view(), name='feedback_all'),
url(r'^catalog/(?P<pk>\d{1,4})/feedback/(?P<id>\d{1,4})/$', FeedbackUpdateView.as_view(), name='feedback_edit'),
url(r'^feedback/delete/(?P<pk>\d{1,4})/$', FeedbackDeleteView.as_view(), name='feedback_delete'),
) )

@ -22,7 +22,8 @@ class SpecialistCatalogForm(TranslatableModelForm):
class Meta: class Meta:
model = SpecialistCatalog model = SpecialistCatalog
fields = '__all__' fields = ['price', 'currency', 'logo_preview', 'main_descr', 'place_photo',
'specialists', 'city', 'country', 'type', 'title', 'benefits']
widgets = { widgets = {
'type': forms.Select(choices=(('1', 'Country'), ('2', 'City'))), 'type': forms.Select(choices=(('1', 'Country'), ('2', 'City'))),
'city': forms.HiddenInput(attrs={'id': 'id_city'}), 'city': forms.HiddenInput(attrs={'id': 'id_city'}),
@ -31,18 +32,6 @@ class SpecialistCatalogForm(TranslatableModelForm):
'benefits': CKEditorWidget, 'benefits': CKEditorWidget,
} }
def clean_city(self):
data = self.cleaned_data
if data.get('city'):
data['city'] = City.objects.language(lang_code).get(id=data['city'])
return data
def clean_country(self):
data = self.cleaned_data
if data.get('country'):
data['country'] = Country.objects.language(lang_code).get(id=data['country'])
return data
def save(self, commit=True): def save(self, commit=True):
place = self.cleaned_data.get('city') or self.cleaned_data.get('country') place = self.cleaned_data.get('city') or self.cleaned_data.get('country')
place_inflect = place.inflect or place.name place_inflect = place.inflect or place.name
@ -57,30 +46,18 @@ class SpecialistForm(forms.ModelForm):
class Meta: class Meta:
model = Specialist model = Specialist
fields = '__all__' fields = ['name','country', 'city', 'photo', 'languages']
widgets = { widgets = {
'city': forms.HiddenInput(attrs={'id': 'id_city'}), 'city': forms.HiddenInput(attrs={'id': 'id_city'}),
'country': forms.Select(choices=country_choices, attrs={'id': 'id_country'}) 'country': forms.Select(choices=country_choices, attrs={'id': 'id_country'})
} }
def clean_city(self):
data = self.cleaned_data
if data.get('city'):
data['city'] = City.objects.language(lang_code).get(id=data['city'])
return data
def clean_country(self):
data = self.cleaned_data
if data.get('country'):
data['country'] = Country.objects.language(lang_code).get(id=data['country'])
return data
class FeedbackForm(forms.ModelForm): class FeedbackForm(forms.ModelForm):
class Meta: class Meta:
model = Feedback model = Feedback
fields = '__all__' fields = ['company', 'name', 'text', 'logo', 'catalog']
widgets = { widgets = {
'text':CKEditorWidget 'text':CKEditorWidget
} }

@ -21,12 +21,15 @@ class Specialist(models.Model):
country = models.ForeignKey(Country, on_delete=models.PROTECT, verbose_name=u"Страна") country = models.ForeignKey(Country, on_delete=models.PROTECT, verbose_name=u"Страна")
photo = models.ImageField(verbose_name=u"Фото", upload_to="specialist_catalog/specialist_photo/", blank=True) photo = models.ImageField(verbose_name=u"Фото", upload_to="specialist_catalog/specialist_photo/", blank=True)
def __unicode__(self):
return u"%s" % self.name
class SpecialistCatalog(TranslatableModel): class SpecialistCatalog(TranslatableModel):
price = models.IntegerField(verbose_name=u"Цена", default=200) price = models.IntegerField(verbose_name=u"Цена", default=200)
currency = models.CharField(max_length=255, verbose_name=u"Валюта", default=u"EUR") currency = models.CharField(max_length=255, verbose_name=u"Валюта", default=u"EUR")
logo_preview = models.ImageField(verbose_name=u"Логотип", blank=True, upload_to='/specialist_catalog/logo_preview/') logo_preview = models.ImageField(verbose_name=u"Логотип", blank=True, upload_to='specialist_catalog/logo_preview/')
place_photo = models.ImageField(verbose_name=u"Фото для города", blank=True, upload_to='/specialist_catalog/place_photo/') place_photo = models.ImageField(verbose_name=u"Фото для города", blank=True, upload_to='specialist_catalog/place_photo/')
specialists = models.ManyToManyField(Specialist, verbose_name=u"Специалисты", blank=True) specialists = models.ManyToManyField(Specialist, verbose_name=u"Специалисты", blank=True)
city = models.ForeignKey(City, on_delete=models.PROTECT, verbose_name=u"Город") city = models.ForeignKey(City, on_delete=models.PROTECT, verbose_name=u"Город")
country = models.ForeignKey(Country, on_delete=models.PROTECT, verbose_name=u"Страна") country = models.ForeignKey(Country, on_delete=models.PROTECT, verbose_name=u"Страна")
@ -83,7 +86,7 @@ class Feedback(models.Model):
company = models.CharField(max_length=255, verbose_name=u"Название компании") company = models.CharField(max_length=255, verbose_name=u"Название компании")
name = models.CharField(max_length=100, verbose_name=u"Имя") name = models.CharField(max_length=100, verbose_name=u"Имя")
text = models.CharField(max_length=5000, verbose_name=u"Текст отзыва") text = models.CharField(max_length=5000, verbose_name=u"Текст отзыва")
logo = models.ImageField(verbose_name=u"Логотип компании", upload_to='/specialist_catalog/feedback_logo/', blank=True) logo = models.ImageField(verbose_name=u"Логотип компании", upload_to='specialist_catalog/feedback_logo/', blank=True)
catalog = models.ForeignKey(SpecialistCatalog, verbose_name=u"Страница") catalog = models.ForeignKey(SpecialistCatalog, verbose_name=u"Страница")

@ -1,30 +1,101 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.views.generic import CreateView, UpdateView, DeleteView, ListView, DetailView from django.views.generic import CreateView, UpdateView, DeleteView, ListView, DetailView
from .forms import * 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): class SpecialistCreateView(CreateView):
form_class = SpecialistForm form_class = SpecialistForm
model = Specialist model = Specialist
template_name = 'admin/specialist/specialist_new.html' template_name = 'admin/specialist/specialist_new.html'
success_url = reverse("specialist_all") success_url = reverse_lazy("specialist_all")
class SpecialistListView(ListView): class SpecialistListView(ListView):
model = Specialist model = Specialist
template_name = 'admin/specialist/specialist_all.html' template_name = 'admin/specialist/specialist_all.html'
paginate_by = settings.ADMIN_PAGINATION
class SpecialistUpdateView(UpdateView): class SpecialistUpdateView(UpdateView):
form_class = SpecialistForm form_class = SpecialistForm
model = Specialist model = Specialist
template_name = 'admin/specialist/specialist_new.html' 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): class SpecialistDeleteView(DeleteView):
model = Specialist model = Specialist
template_name = 'admin/specialist/specialist_confirm_delete.html' 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>&nbsp; </th>
<th>Заголовок</th>
<th>Тип</th>
<th>Количество специалистов</th>
<th>&nbsp;</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>&nbsp;</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>&nbsp;</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 %}

@ -1,4 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load thumbnail %}
{% block body %} {% block body %}
<div class="box span8"> <div class="box span8">
<div class="box-header well"> <div class="box-header well">
@ -9,8 +10,10 @@
<thead> <thead>
<tr> <tr>
<th>Фото </th>
<th>Имя</th> <th>Имя</th>
<th>Заголовок</th> <th>Город</th>
<th>Языки</th>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
</thead> </thead>
@ -18,16 +21,21 @@
{% for item in object_list %} {% for item in object_list %}
<tr> <tr>
<td><a href = "{{ item.url }}/">{{ item.url }}</a></td> <td>
<td>{{ item.title }}</td> {% thumbnail item.photo "100x100" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}</td>
<td>{{ item.name }}</td>
<td>{{ item.city.name }}</td>
<td>{{ item.languages }}</td>
<td class="center sorting_1"> <td class="center sorting_1">
<a class="btn-small btn-info" href='{% url "seo_edit" item.id %}'> <a class="btn-small btn-info" href='{% url "specialist_edit" item.id %}'>
Изменить Изменить
</a> </a>
</td> </td>
<td> <td>
<a class="btn-small btn-danger delete" href='{% url "seo_delete" item.id %}'> <a class="btn-small btn-danger delete" href='{% url "specialist_delete" item.id %}'>
Удалить Удалить
</a> </a>
</td> </td>
@ -35,8 +43,8 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<a class="btn btn-success" href='{% url "seo_new" %}'> <a class="btn btn-success" href='{% url "specialist_new" %}'>
<i class="icon-plus-sign icon-white"></i> Добавить seo-текст </a> <i class="icon-plus-sign icon-white"></i> Хочу еще </a>
</div> </div>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">

@ -3,9 +3,9 @@
{% block body %} {% block body %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
<div class="controls"> <div class="controls">
<p>Вы точно хотите удалить seo-текст "{{ object.title }}" для страницы <a href = "{{ object.url }}"></a> ?</p> <p>Вы точно хотите удалить "{{ object.name }}" ?</p>
<input class="btn btn-large btn-danger delete" type="submit" value="Да" /> <input class="btn btn-large btn-danger delete" type="submit" value="Да" />
<a class="btn btn-large btn-primary" href = {% url 'seo_all' %}>Нет</a> <a class="btn btn-large btn-primary" href = {% url 'specialist_all' %}>Нет</a>
</div> </div>
</form> </form>
{% endblock %} {% endblock %}

@ -3,74 +3,74 @@
{# Displays article form #} {# Displays article form #}
{% block scripts %} {% block scripts %}
{# selects for city and country #}
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script> <link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
{# selects #} <style>
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/> .thumb {
<script src="{% static 'js/select/select2.js' %}"></script> height: 75px;
<script src="{% static 'custom_js/make_select.js' %}"></script> border: 1px solid #000;
{# ajax #} margin: 10px 5px 0 0;
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script> }
<script src="{% static 'custom_js/select_tag.js' %}"></script> </style>
<script src="{% static 'js/select/select2.js' %}"></script>
<script src="{% static 'custom_js/specialist.js' %}?ad=ddd"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{{ request.LANGUAGE_CODE }} <form method="post" class="form-horizontal" enctype="multipart/form-data"> {% csrf_token %}
<form method="post" class="form-horizontal" > {% csrf_token %}
<fieldset> <fieldset>
<div class="box span8"> <div class="box span8">
<div class="box-header well"> <div class="box-header well">
<h2><i class="icon-pencil"></i> Основная информация</h2> <h2><i class="icon-pencil"></i> Добавление специалиста(переводчика)</h2>
</div> </div>
<div class="box-content"> <div class="box-content">
{# url/slug #} {# name #}
<div class="control-group {% if form.url.errors %}error{% endif %}"> <div class="control-group {% if form.name.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.url.label }}:</b></label> <label class="control-label"><b>{{ form.name.label }}:</b></label>
<div class="controls"> <div class="controls">
{{ form.langs }} {{ form.name }}<span class="help-inline"></span>
{{ form.url }}<span class="help-inline"></span> <span class="help-inline">{{ form.name.errors }}</span>
<span class="help-inline">{{ form.url.errors }}</span>
</div> </div>
</div> </div>
{# title #} {# languages #}
<div class="control-group {% if form.title.errors %}error{% endif %}"> <div class="control-group {% if form.languages.errors %}error{% endif %}">
<label class="control-label">{{ form.title.label }}:</label> <label class="control-label">{{ form.languages.label }}:</label>
<div class="controls"> <div class="controls">
{{ form.title }} {{ form.languages }}
<span class="help-inline">{{ form.title.errors }}</span> <span class="help-inline">{{ form.languages.errors }}</span>
</div> </div>
</div> </div>
{# page title #} {# country #}
<div class="control-group {% if form.page_title.errors %}error{% endif %}"> <div class="control-group {% if form.country.errors %}error{% endif %}">
<label class="control-label">{{ form.page_title.label }}:</label> <label class="control-label">{{ form.country.label }}:</label>
<div class="controls"> <div class="controls">
{{ form.page_title }} {{ form.country }}
<span class="help-inline">{{ form.page_title.errors }}</span> <span class="help-inline">{{ form.country.errors }}</span>
</div> </div>
</div> </div>
{# description #} {# city #}
<div class="control-group {% if form.description.errors %}error{% endif %}"> <div class="control-group {% if form.city.errors %}error{% endif %}">
<label class="control-label">{{ form.description.label }}:</label> <label class="control-label">{{ form.city.label }}:</label>
<div class="controls"> <div class="controls">
{{ form.description }} {{ form.city }}
<span class="help-inline">{{ form.description.errors }}</span> <span class="help-inline">{{ form.city.errors }}</span>
</div> </div>
</div> </div>
{# body #} {# photo #}
<div class="control-group {% if form.body.errors %}error{% endif %}"> <div class="control-group {% if form.photo.errors %}error{% endif %}">
<label class="control-label">{{ form.body.label }}:</label> <label class="control-label">{{ form.photo.label }}:</label>
<div class="controls"> <div class="controls">
{{ form.body }} {{ form.photo }} <output id="list"></output>
<span class="help-inline">{{ form.body.errors }}</span> <span class="help-inline">{{ form.photo.errors }}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="controls"> <div class="controls">
<input class="btn btn-large btn-primary" type="submit" {% if request.path == '/admin/meta/seo/new/' %} value="Добавить" {% else %} value='Изменить' {% endif %}/> <input class="btn btn-large btn-primary" type="submit" {% if request.path == '/admin/specialist_catalog/specialist/new/' %} value="Добавить" {% else %} value='Изменить' {% endif %}/>
<input class="btn btn-large" type="reset" value="Отмена"> <input class="btn btn-large" type="reset" value="Отмена">
</div> </div>
</fieldset> </fieldset>

Loading…
Cancel
Save