remotes/origin/1203
Nazar Kotyuk 12 years ago
parent dd2fa41a2d
commit 3458ff1e83
  1. 2
      company/views.py
  2. 3
      core/views.py
  3. 2
      exposition/models.py
  4. BIN
      media/imgs/cl-logo-3.png
  5. 2
      media/import/.~lock.places_en.xlsx#
  6. 1
      media/import/.~lock.places_en123.xlsx#
  7. BIN
      media/import/halls_en.xlsx
  8. 0
      media/import/places_en123.xlsx
  9. 33
      place_exposition/management/commands/place_en.py
  10. 4
      place_exposition/models.py
  11. 3
      templates/client/base_catalog.html
  12. 6
      templates/client/includes/catalog_search.html

@ -35,6 +35,7 @@ class CompanySearchView(ListView):
del queries['page']
context['queries'] = queries
context['search_action'] = '/members/search/'
context['type'] = 'members search'
return context
@ -48,6 +49,7 @@ class CompanyView(ExpoListView):
def get_context_data(self, **kwargs):
context = super(CompanyView, self).get_context_data(**kwargs)
context['search_action'] = '/members/search/'
context['type'] = 'members search'
return context
class CompanyExposition(CompanyView):

@ -39,6 +39,7 @@ class EventSearchView(ListView):
context['queries'] = queries
context['search_action'] = '/events/search/'
return context
class PlaceSearchView(ListView):
@ -66,6 +67,7 @@ class PlaceSearchView(ListView):
del queries['page']
context['queries'] = queries
context['search_action'] = '/places/search/'
context['type'] = 'places search'
return context
@ -138,6 +140,7 @@ class PlaceListView(ListView):
context['single_page'] = self.single_page
context['search_form'] = self.search_form
context['search_action'] = '/places/search/'
context['type'] = 'places search'
return context
class PlacePhotoView(PlaceListView):

@ -162,7 +162,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
theme = self.theme.all()[0]
now = datetime.datetime.now()
now = now.replace(day=now.day-1)
expositions = Exposition.objects.filter(theme__in=[theme], data_begin__gt=now).exclude(id=self.id)
expositions = Exposition.objects.filter(theme__in=[theme], data_begin__gt=now).exclude(id=self.id).order_by('data_begin')
return expositions[:3]
else:
return []

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -1 +1 @@
kotzilla ,kotzilla,kotzilla-Satellite-L300,27.05.2014 02:19,file:///home/kotzilla/.config/libreoffice/3;
kotzilla ,kotzilla,kotzilla-Satellite-L300,27.05.2014 17:23,file:///home/kotzilla/.config/libreoffice/3;

@ -0,0 +1 @@
kotzilla ,kotzilla,kotzilla-Satellite-L300,27.05.2014 17:23,file:///home/kotzilla/.config/libreoffice/3;

Binary file not shown.

@ -11,7 +11,7 @@ from django.conf import settings
class Command(BaseCommand):
def handle(self, *args, **options):
f = open(settings.MEDIA_ROOT+'/import/places_en.xlsx', 'r')
f = open(settings.MEDIA_ROOT+'/import/halls_en.xlsx', 'r')
book = xlrd.open_workbook(file_contents=f.read())
@ -21,6 +21,8 @@ class Command(BaseCommand):
row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)]
labels = [label for label in row_list[0]]
for row_number, row in enumerate(row_list):
# go through all rows in file
if row_number > 0:
@ -31,6 +33,7 @@ class Command(BaseCommand):
object = PlaceExposition.objects.language('en').get(id=int(row[0]))
except:
continue
methods = []
for col_number, cell in enumerate(row):
# go through row cells
# field name current cell
@ -39,6 +42,12 @@ class Command(BaseCommand):
if setting is None:
continue
if setting.get('method'):
if cell != "":
methods.append({'func': setting['func'], 'value': cell, 'purpose': setting.get('purpose')})
continue
field_name = setting['field']
func = setting.get('func')
@ -58,7 +67,23 @@ class Command(BaseCommand):
# setattr(object, 'address', google_address(value))
setattr(object, field_name, value)
print(object.description)
object.save()
print('post save %s'% str(object))
try:
object.save()
print('post save %s'% str(object))
except:
continue
for method in methods:
func = method['func']
if method.get('purpose'):
try:
func(object, method['value'], method['purpose'])
except:
continue
else:
try:
func(object, method['value'])
except:
continue

@ -117,7 +117,9 @@ class PlaceExposition(TranslatableModel, ExpoMixin):
def get_photos(self):
photos = self.photos.all()
return photos
ph = self.files.filter(purpose='photo')
return list(photos)+list(ph)
def get_scheme(self):
scheme = self.files.filter(purpose='scheme teritory')

@ -52,8 +52,7 @@
</aside>
<div class="mcl">
{% with search_form=search_form search_action=search_action%}
{% with search_form=search_form search_action=search_action type=type%}
{% include 'client/includes/catalog_search.html' %}
{% endwith %}

@ -3,7 +3,7 @@
<div class="in-search-form">
<form action="{{ search_action }}">
<div class="s-title">{% trans 'поиск событий' %}</div>
<div class="s-title">{% if type %}{{ type }}{% else %}{% trans 'поиск событий' %}{% endif %}</div>
<div class="search-form-wrap">
<div class="search-line">
<div class="sf-field-wrap">
@ -23,9 +23,9 @@
</div>
</div>
<div class="search-line sl-options">
<div class="sf-field-wrap">{% trans 'Тематика: ' %}<a class="pw-open" href="#pw-subj">Не важно</a></div>
{% ifnotequal type 'places search' %}<div class="sf-field-wrap">{% trans 'Тематика: ' %}<a class="pw-open" href="#pw-subj">Не важно</a></div>{% endifnotequal %}
<div class="sf-field-wrap">{% trans 'Место: ' %}<a class="pw-open" href="#pw-place">Не важно</a></div>
<div class="sf-field-wrap">{% trans 'Период: ' %}<a class="pw-open" href="#pw-period">Не важно</a></div>
{% ifnotequal type 'places search' %}<div class="sf-field-wrap">{% trans 'Период: ' %}<a class="pw-open" href="#pw-period">Не важно</a></div>{% endifnotequal %}
</div>
</div>
</form>

Loading…
Cancel
Save