remotes/origin/1203
Назар Котюк 11 years ago
parent 4b9a5a1889
commit 1b25c9c6a6
  1. 8
      accounts/forms.py
  2. 2
      accounts/views.py
  3. 16
      article/views.py
  4. 2
      company/edit_views.py
  5. 2
      company/models.py
  6. 5
      conference/admin.py
  7. 2
      conference/forms.py
  8. 15
      templates/admin/conference/conference.html
  9. 10
      templates/admin/conference/conference_all.html
  10. 14
      templates/admin/conference/conference_list.html
  11. 2
      templates/client/includes/accounts/current_user.html
  12. 2
      templates/client/includes/accounts/simple_user.html
  13. 2
      templates/client/includes/company/company_edit.html
  14. 4
      templates/client/includes/company/company_object.html
  15. 11
      templates/client/popups/user_information.html

@ -218,7 +218,7 @@ class EmailAnnouncementForm(forms.Form):
class RegistrationCompleteForm(forms.ModelForm): class RegistrationCompleteForm(forms.ModelForm):
country = forms.ChoiceField(label='Страна', choices=[(c.id, c.name) for c in Country.objects.all()], country = forms.ModelChoiceField(label='Страна', queryset= Country.objects.all(),
widget=forms.Select(attrs={'class': 'select2'})) widget=forms.Select(attrs={'class': 'select2'}))
city = forms.CharField(label='Город', widget=forms.HiddenInput()) city = forms.CharField(label='Город', widget=forms.HiddenInput())
url = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'url(обязательно)')})) url = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'url(обязательно)')}))
@ -254,12 +254,6 @@ class RegistrationCompleteForm(forms.ModelForm):
return None return None
def clean_country(self):
try:
return Country.objects.get(id=self.cleaned_data['country'])
except City.DoesNotExist:
return None
def clean_url(self): def clean_url(self):
url = self.cleaned_data['url'] url = self.cleaned_data['url']
if not is_latin(url): if not is_latin(url):

@ -296,7 +296,7 @@ class AvatarView(BaseProfileView):
form = self.form_class(self.request.POST, self.request.FILES, instance=profile) form = self.form_class(self.request.POST, self.request.FILES, instance=profile)
profile = form.save() profile = form.save()
if self.request.is_ajax(): if self.request.is_ajax():
im = get_thumbnail(profile.avatar, '100x100') im = get_thumbnail(profile.avatar, '100x100', format="PNG")
response = {'success': True, 'url': im.url, 'rating': profile.user.rating} response = {'success': True, 'url': im.url, 'rating': profile.user.rating}
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
else: else:

@ -1,7 +1,9 @@
import json
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.http import HttpResponse from django.http import HttpResponse
from models import Article from models import Article
from forms import ArticleFilterForm from forms import ArticleFilterForm
from theme.models import Tag
@ -18,7 +20,10 @@ class NewsList(ListView):
qs = qs.filter(theme__id__in=themes) qs = qs.filter(theme__id__in=themes)
tags = self.request.GET.getlist('tag') tags = self.request.GET.getlist('tag')
if u'' in tags:
tags.remove(u'')
if tags: if tags:
tags = tags[0].split(',')
qs = qs.filter(tag__id__in=tags) qs = qs.filter(tag__id__in=tags)
return qs return qs
@ -29,6 +34,15 @@ class NewsList(ListView):
context = super(NewsList, self).get_context_data(object_list=self.object_list) context = super(NewsList, self).get_context_data(object_list=self.object_list)
if self.request.GET: if self.request.GET:
filter_form = ArticleFilterForm(self.request.GET) filter_form = ArticleFilterForm(self.request.GET)
tags = self.request.GET.getlist('tag')
if u'' in tags:
tags.remove(u'')
if tags:
tags = tags[0].split(',')
tag_qs = Tag.objects.filter(id__in=tags)
tags = [{'id': str(tag.id), 'text': tag.name} for tag in tag_qs]
filter_form.fields['tag'].widget.attrs['data-predifined'] = json.dumps(tags)
filter_form.fields['tag'].widget.attrs['value'] = ''
else: else:
filter_form = ArticleFilterForm() filter_form = ArticleFilterForm()
@ -57,6 +71,8 @@ class BlogList(ListView):
qs = qs.filter(theme__id__in=themes) qs = qs.filter(theme__id__in=themes)
tags = self.request.GET.getlist('tag') tags = self.request.GET.getlist('tag')
if u'' in tags:
tags.remove(u'')
if tags: if tags:
qs = qs.filter(tag__id__in=tags) qs = qs.filter(tag__id__in=tags)

@ -53,7 +53,7 @@ class LogoView(BaseView):
form = self.form_class(self.request.POST, self.request.FILES, instance=company) form = self.form_class(self.request.POST, self.request.FILES, instance=company)
company = form.save() company = form.save()
if self.request.is_ajax(): if self.request.is_ajax():
im = get_thumbnail(company.logo, '100x100') im = get_thumbnail(company.logo, '100x100', format="PNG")
response = {'success': True, 'url': im.url, 'rating': company.rating} response = {'success': True, 'url': im.url, 'rating': company.rating}
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
else: else:

@ -119,7 +119,7 @@ class Company(TranslatableModel, ExpoMixin):
def calculate_rating(company): def calculate_rating(company):
rating_simple = {'country': 5, 'city': 5, 'address_inf': 10, 'phone': 10, 'fax': 5, 'email': 10, rating_simple = {'country': 5, 'city': 5, 'address_inf': 10, 'phone': 10, 'fax': 5, 'email': 10,
'facebook': 5, 'twitter': 5, 'linkedin': 5, 'vk': 5, 'web_page': 10, #'logo': 20, 'facebook': 5, 'twitter': 5, 'linkedin': 5, 'vk': 5, 'web_page': 10, 'logo': 20,
'specialization': 5, 'description':15, 'foundation': 5, 'staff_number': 5}# участие и посещение доделать 'specialization': 5, 'description':15, 'foundation': 5, 'staff_number': 5}# участие и посещение доделать
rating_methods = {'theme': 10, 'tag': 5, 'photo':5} rating_methods = {'theme': 10, 'tag': 5, 'photo':5}
# base rating # base rating

@ -236,9 +236,10 @@ class ConferenceView(AdminView):
data = {'web_page':obj.web_page, 'foundation_year': obj.foundation_year, data = {'web_page':obj.web_page, 'foundation_year': obj.foundation_year,
'data_begin':obj.data_begin, 'data_end':obj.data_end, 'currency':obj.currency, 'data_begin':obj.data_begin, 'data_end':obj.data_end, 'currency':obj.currency,
'tax':obj.tax, 'min_price':obj.min_price, 'max_price':obj.max_price, 'tax':obj.tax, 'min_price':obj.min_price, 'max_price':obj.max_price,
'link':obj.link, 'conference_id':obj.id, 'expohit': obj.expohit, 'link':obj.link, 'conference_id':obj.id, 'expohit': obj.expohit, 'periodic':obj.periodic,
'discount': obj.discount,'canceled': obj.canceled, 'moved': obj.moved, 'discount': obj.discount,'canceled': obj.canceled, 'moved': obj.moved,
'visitors': obj.visitors, 'members': obj.members, 'visitors': obj.visitors, 'members': obj.members, 'logo': obj.logo,
'audience':[item for item, bool in obj.audience if bool==True],
'quality_label': [item for item, bool in obj.quality_label if bool==True]} 'quality_label': [item for item, bool in obj.quality_label if bool==True]}
if obj.place: if obj.place:

@ -172,7 +172,7 @@ class ConferenceCreateForm(forms.Form):
if data.get('country'): if data.get('country'):
conference.country = Country.objects.get(id=data['country'].id)#.id cause select uses queryset conference.country = Country.objects.get(id=data['country'])#.id cause select uses queryset
if data.get('city'): if data.get('city'):
conference.city = City.objects.get(id=data['city']) conference.city = City.objects.get(id=data['city'])

@ -149,6 +149,13 @@
</div> </div>
</div> </div>
</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 }}
<span class="help-inline">{{ form.logo.errors }}</span>
</div>
</div>
</div> </div>
<div class="box span8" > <div class="box span8" >
@ -160,7 +167,13 @@
{% with field='description' form=form languages=languages %} {% with field='description' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %} {% include 'admin/forms/multilang.html' %}
{% endwith %} {% endwith %}
{# periodic #}
<div class="control-group {% if form.periodic.errors %}error{% endif %}">
<label class="control-label">{{ form.periodic.label }}:</label>
<div class="controls">{{ form.periodic }}
<span class="help-inline">{{ form.periodic.errors }}</span>
</div>
</div>
{# web_page #} {# web_page #}
<div class="control-group {% if form.web_page.errors %}error{% endif %}"> <div class="control-group {% if form.web_page.errors %}error{% endif %}">
<label class="control-label">{{ form.web_page.label }}:</label> <label class="control-label">{{ form.web_page.label }}:</label>

@ -45,20 +45,16 @@
</td> </td>
<td class="center sorting_1"> <td class="center sorting_1">
<a class="btn-small btn-info" href="/admin/conference/change/{{ item.url|lower }}"> <a class="btn-small btn-info" href="/admin/conference/{{ item.url|lower }}">
Изменить Изменить
</a> </a>
</td> </td>
<td>
<a class="btn-small btn-inverse" href="/admin/conference/copy/{{ item.url|lower }}">
Копировать
</a>
</td>
<td> <td>
<a class="btn btn-danger" href="/admin/conference/delete/{{ item.url|lower }}"> <a class="btn btn-danger" href="/admin/conference/delete/{{ item.url|lower }}">
<i class="icon-trash icon-white"></i> Удалить Удалить
</a> </a>
</td> </td>

@ -56,20 +56,14 @@
</td> </td>
<td class="center sorting_1"> <td class="center sorting_1">
<a class="btn-small btn-info" href="/admin/conference/change/{{ item.url|lower }}"> <a class="btn-small btn-info" href="/admin/conference/{{ item.url|lower }}">
Изменить Изменить
</a> </a>
</td> </td>
<td> <td>
<a class="btn-small btn-inverse" href="/admin/conference/copy/{{ item.url|lower }}"> <a class="btn-small btn-danger" href="/admin/conference/delete/{{ item.url|lower }}">
Копировать Удалить
</a>
</td>
<td>
<a class="btn btn-danger" href="/admin/conference/delete/{{ item.url|lower }}">
<i class="icon-trash icon-white"></i> Удалить
</a> </a>
</td> </td>
@ -78,7 +72,7 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<a class="btn btn-success" href="/admin/conference/add"><i class="icon-plus-sign icon-white"></i> Добавить конференцию</a> <a class="btn btn-success" href="/admin/conference/"><i class="icon-plus-sign icon-white"></i> Добавить конференцию</a>
</div> </div>
{# pagination #} {# pagination #}
{% include 'admin/includes/admin_pagination.html' with page_obj=object_list %} {% include 'admin/includes/admin_pagination.html' with page_obj=object_list %}

@ -22,7 +22,7 @@
<div id="pick-block" class="pic_block"> <div id="pick-block" class="pic_block">
{% if request.user.profile.avatar %} {% if request.user.profile.avatar %}
{% thumbnail request.user.profile.avatar "100x100" as im %} {% thumbnail request.user.profile.avatar "100x100" format="PNG" as im %}
<img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/> <img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
{% endthumbnail %} {% endthumbnail %}
{% else %} {% else %}

@ -8,7 +8,7 @@
<aside> <aside>
<div class="i-pict"> <div class="i-pict">
{% if member.profile.avatar %} {% if member.profile.avatar %}
{% thumbnail member.profile.avatar "100x100" as im %} {% thumbnail member.profile.avatar "100x100" format="PNG" as im %}
<img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/> <img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
{% endthumbnail %} {% endthumbnail %}
{% else %} {% else %}

@ -20,7 +20,7 @@
<div id="pick-block" class="pic_block"> <div id="pick-block" class="pic_block">
{% if company.logo %} {% if company.logo %}
{% thumbnail company.logo "100x100" as im %} {% thumbnail company.logo "100x100" format="PNG" as im %}
<img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/> <img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
{% endthumbnail %} {% endthumbnail %}
{% else %} {% else %}

@ -9,7 +9,7 @@
<aside> <aside>
<div class="i-pict"> <div class="i-pict">
{% if company.logo %} {% if company.logo %}
{% thumbnail company.logo "100x100" as im %} {% thumbnail company.logo "100x100" format="PNG" as im %}
<img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/> <img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
{% endthumbnail %} {% endthumbnail %}
{% else %} {% else %}
@ -24,7 +24,7 @@
<div class="i-title">{{ company.name|safe }}</div> <div class="i-title">{{ company.name|safe }}</div>
<div class="i-place p-editable editable-wrap "> <div class="i-place p-editable editable-wrap ">
<span class="static-value"> <span class="static-value">
Украина, Белая Церковь {{ company.country.name }}, {{ company.city.name }}
</span> </span>
</div> </div>
</header> </header>

@ -13,7 +13,16 @@
<li class="input_top"> <li class="input_top">
<div class="pwf-line"> <div class="pwf-line">
<div class="pwf-field"> <div class="pwf-field">
{{ form.country }}
<select class="select2" id="id_country" name="country">
{% with countries=form.country.field.queryset %}
{% for country in countries %}
<option value="{{ country.id }}" data-phone-code="{% if country.phone_code %}{{ country.phone_code }}{% endif %}" >{{ country.name }}</option>
{% endfor %}
{% endwith %}
</select>
</div> </div>
<div class="pwf-msg err-message-box"></div> <div class="pwf-msg err-message-box"></div>
</div> </div>

Loading…
Cancel
Save