diff --git a/accounts/management/__init__.py b/accounts/management/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/accounts/management/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/accounts/management/commands/__init__.py b/accounts/management/commands/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/accounts/management/commands/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/accounts/management/commands/load_accounts.py b/accounts/management/commands/load_accounts.py new file mode 100644 index 00000000..6d2147fb --- /dev/null +++ b/accounts/management/commands/load_accounts.py @@ -0,0 +1,82 @@ +import os +import MySQLdb +from MySQLdb.cursors import DictCursor +from django.core.management.base import BaseCommand +from accounts.models import User + +def create_new_user(data): + email = data['email'] + firstname = data['firstname'] + lastname = data['lastname'] + position = data['position'] + web_page = data['web_page'] + fb = data['fb'] + li = data['li'] + sk = data['sk'] + about = data['about'] + password = data['password'] + url = data['url'] + if not url: + url = str(data['id']) + + user = User(username=email, first_name=firstname, last_name=lastname, email=email, + is_staff=False, is_active=True, is_superuser=False, password=password, position=position, url=url) + + try: + user.save() + except: + return + profile = user.profile + + profile.web_page = web_page + profile.facebook = fb + profile.linkedin = li + profile.skype = sk + profile.about = about + try: + profile.save() + except: + pass + + return + + +class Command(BaseCommand): + def handle(self, *args, **options): + db = MySQLdb.connect(host="localhost", + user="expomap", + passwd="7FbLtAGjse", + db="old_db", + charset='utf8', + cursorclass=DictCursor) + cursor = db.cursor() + sql = """ + SELECT customers_id as id, customers_email_address as email, customers_password as password, customers_firstname as firstname , + customers_lastname as lastname , customers_telephone as phone, customers_job as `position`, customers_web as web_page, + customers_facebook as fb, customers_linkedin as li, customers_skype as sk, customers_about as about, + url + FROM `customers` + where customers_email_address!='' + + """ + + + + + cursor.execute(sql) + result = cursor.fetchall() + + #user.password = result[0]['customers_password'] + + for res in result: + email = res['email'] + print(email) + try: + user = User.objects.get(username=email) + except User.DoesNotExist: + user = None + create_new_user(res) + if user: + password = res['password'] + user.password = password + user.save() diff --git a/article/management/__init__.py b/article/management/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/article/management/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/article/management/commands/__init__.py b/article/management/commands/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/article/management/commands/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/article/management/commands/article_load.py b/article/management/commands/article_load.py new file mode 100644 index 00000000..70130815 --- /dev/null +++ b/article/management/commands/article_load.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +import xlrd +from django.core.management.base import BaseCommand +from django.conf import settings +from article.models import Article +from import_xls.excel_settings import article_sett +from django.db import IntegrityError + + +NEWS_FILE = settings.MEDIA_ROOT+'/import/news.xls' + + +class Command(BaseCommand): + def handle(self, *args, **options): + + f = open(NEWS_FILE, 'r') + book = xlrd.open_workbook(file_contents=f.read()) + sheet = book.sheet_by_index(0) + row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] + labels = [label for label in row_list[0]] + existing = 0 + for row_number, row in enumerate(row_list[2:]): + + published = row[4] + if row[0] != '': + # in first column ids + try: + object = Article.objects.language('ru').get(id=int(row[0])) + object.type = Article.news + object.save() + print(object.type) + continue + except ValueError: + + object = Article(type=Article.news) + object.translate('ru') + except Article.DoesNotExist: + object = Article(id= int(row[0])) + object.translate('ru') + existing += 1 + else: + # if id blank - its a new place + object = Article(type=Article.news) + object.translate('ru') + + for col_number, cell in enumerate(row): + + label = labels[col_number] + setting = article_sett.get(label) + if setting is None: + continue + + field_name = setting['field'] + func = setting.get('func') + value = func(cell) + setattr(object, field_name, value) + object.publish_date = published + try: + object.save() + except Exception, e: + print(e) + diff --git a/article/management/commands/articles_from_old.py b/article/management/commands/articles_from_old.py new file mode 100644 index 00000000..f2034aa2 --- /dev/null +++ b/article/management/commands/articles_from_old.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +import MySQLdb +from MySQLdb.cursors import DictCursor +from django.core.management.base import BaseCommand, CommandError +from functions.translate import fill_with_signal +from article.models import Article +from accounts.models import User + + +class Command(BaseCommand): + def handle(self, *args, **options): + db = MySQLdb.connect(host="localhost", + user="kotzilla", + passwd="qazedc", + db="old_expomap", + charset='utf8', + cursorclass=DictCursor) + cursor = db.cursor() + + sql = """SELECT articles_description.articles_id as id , + articles_description.articles_name as main_title, + articles_description.articles_description as description, + articles.authors_id as author, + articles_description.articles_intro as preview, + articles.articles_date_added as created, + articles.articles_last_modified as modified, + articles.articles_date_available as publish_date, + articles_description.articles_head_title_tag as title, + articles_description.articles_head_desc_tag as descriptions, + articles_description.articles_head_keywords_tag as keywords + + FROM `articles_description` + JOIN articles + ON articles_description.articles_id=articles.articles_id""" + + cursor.execute(sql) + + result = cursor.fetchall() + user = User.objects.get(id=1) + Article.objects.blogs().delete() + for a in result: + article = Article(type=Article.blog, + id=a['id'], + created=a['created'], + modified=a['modified'], + publish_date=a['publish_date']) + + article.author = user + + article.translate('ru') + article.main_title = a['main_title'] + article.preview = a['preview'] + article.description = a['description'] + article.title = a['title'] + article.keywords = a['keywords'] + if len(a['descriptions'])<255: + article.descriptions = a['descriptions'] + article.save() + print(article) + + #print(a['main_title']) + + diff --git a/article/management/commands/news_from_old.py b/article/management/commands/news_from_old.py new file mode 100644 index 00000000..e8706c32 --- /dev/null +++ b/article/management/commands/news_from_old.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +import MySQLdb +from MySQLdb.cursors import DictCursor +from django.core.management.base import BaseCommand, CommandError +from functions.translate import fill_with_signal +from article.models import Article +from accounts.models import User +from django.db import IntegrityError + +class Command(BaseCommand): + def handle(self, *args, **options): + db = MySQLdb.connect(host="localhost", + user="expomap", + passwd="7FbLtAGjse", + db="old_db", + charset='utf8', + cursorclass=DictCursor) + cursor = db.cursor() + sql = """SELECT news_id as id , + headline as main_title, + content as description, + cid as author, + date_added as created + + FROM `latest_news` + WHERE status = 1 + AND `date_added` >= '2015-04-03' + order by created DESC""" + + cursor.execute(sql) + + result = cursor.fetchall() + user = User.objects.get(id=1) + + #Article.objects.news().delete() + + for a in result: + title = a['main_title'] + id = a['id'] + published = a['created'] + #try: + # news = Article.objects.get(id=id) + #except Article.DoesNotExist: + # continue + + #news.publish_date = published + #news.save() + + if len(a['main_title'])>255 or not a['main_title']: + continue + + + article = Article(type=Article.news, + id=a['id'], + created=a['created']) + if a['author']: + try: + author = User.objects.get(id=a['author']) + except User.DoesNotExist: + author = user + else: + author = user + + article.author = author + + article.translate('ru') + article.main_title = a['main_title'] + article.description = a['description'] + try: + article.save() + print(article) + except : + print ('error. id:%d'%a['id']) + + + + + #print(a['main_title']) + diff --git a/article/management/commands/news_generate_file.py b/article/management/commands/news_generate_file.py new file mode 100644 index 00000000..57af5a16 --- /dev/null +++ b/article/management/commands/news_generate_file.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +import MySQLdb +from MySQLdb.cursors import DictCursor +from django.core.management.base import BaseCommand, CommandError +from functions.translate import fill_with_signal +from article.models import Article +from accounts.models import User +from django.db import IntegrityError +import xlwt +from django.utils import translation +from django.conf import settings + +class Command(BaseCommand): + def handle(self, *args, **options): + translation.activate('en') + + workbook = xlwt.Workbook(encoding = 'utf8') + worksheet = workbook.add_sheet('My Worksheet') + + font = xlwt.Font() + font.name = 'Times New Roman' + font.bold = True + + style = xlwt.XFStyle() + # Create the Style + style.font = font + + qs = Article.objects.news() + worksheet.write(0, 0, 'id') + worksheet.write(0, 1, 'url') + worksheet.write(0, 2, 'title') + + row = 1 + for a in qs: + print a.id + url = a.slug + id = a.id + name = a.main_title + + worksheet.write(row, 0, id) + worksheet.write(row, 1, url) + worksheet.write(row, 2, name) + + row += 1 + workbook.save(settings.MEDIA_ROOT+'/import/exported_news.xls') \ No newline at end of file diff --git a/article/management/commands/update_news.py b/article/management/commands/update_news.py new file mode 100644 index 00000000..50329f04 --- /dev/null +++ b/article/management/commands/update_news.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +import MySQLdb +import datetime +from django.utils.translation import activate +from MySQLdb.cursors import DictCursor +from django.core.management.base import BaseCommand, CommandError +from django.conf import settings +import xlrd +from import_xls.utils import to_theme, to_tag +from functions.translate import fill_with_signal +from article.models import Article +from accounts.models import User +from django.db import IntegrityError +from exposition.models import Exposition + +NEWS_FILE = settings.MEDIA_ROOT+'/import/exported_news.xls' +BLOGS_FILE = settings.MEDIA_ROOT+'/import/blogs.xls' + + + +class Command(BaseCommand): + def handle(self, *args, **options): + activate('ru') + f = open(BLOGS_FILE, 'r') + book = xlrd.open_workbook(file_contents=f.read()) + sheet = book.sheet_by_index(0) + row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] + + + + + print(len(row_list)) + + + existing = 0 + + + for row_number, row in enumerate(row_list[2:]): + + id = int(row[0]) + if id == 49: + continue + + main_title = row[1] + theme = row[2] + tag = row[3] + description = row[4] + article = Article.objects.language('ru').get(id=id) + #article.main_title = main_title + #article.description = description + #article.save() + + + to_theme(article, theme) + to_tag(article, tag) + print(id) + """ + try: + expo = Exposition.objects.filter(translations__name=event)[0] + except IndexError: + expo = None + + if expo: + article.exposition = expo + article.save() + print(id) + """ + + diff --git a/banners/__init__.py b/banners/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/banners/models.py b/banners/models.py new file mode 100644 index 00000000..a690ec3f --- /dev/null +++ b/banners/models.py @@ -0,0 +1,10 @@ +from django.db import models + +# Create your models here. + +class Redirect(models.Model): + redirect = models.URLField() + count = models.PositiveIntegerField(default=0) + + def __unicode__(self): + return self.redirect diff --git a/banners/tests.py b/banners/tests.py new file mode 100644 index 00000000..501deb77 --- /dev/null +++ b/banners/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase + + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.assertEqual(1 + 1, 2) diff --git a/banners/urls.py b/banners/urls.py new file mode 100644 index 00000000..a0ce0988 --- /dev/null +++ b/banners/urls.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +from django.conf.urls import patterns, url + +urlpatterns = patterns('', + url(r'redirect/(?P.*)/$', 'banners.views.redirect'), +) + diff --git a/banners/views.py b/banners/views.py new file mode 100644 index 00000000..22eb6ca5 --- /dev/null +++ b/banners/views.py @@ -0,0 +1,10 @@ +from django.http import HttpResponseRedirect +from django.shortcuts import get_object_or_404 +from banners.models import Redirect +from django.db.models import F + +def redirect(request, id): + redirect = get_object_or_404(Redirect, id=id) + Redirect.objects.filter(id=id).update(count=F('count')+1) + return HttpResponseRedirect(redirect.redirect) + diff --git a/conference/management/__init__.py b/conference/management/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/conference/management/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/conference/management/commands/__init__.py b/conference/management/commands/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/conference/management/commands/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/conference/management/commands/conf_load.py b/conference/management/commands/conf_load.py new file mode 100644 index 00000000..b03c8092 --- /dev/null +++ b/conference/management/commands/conf_load.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +import xlrd +from django.core.management.base import BaseCommand +from django.conf import settings +from conference.models import Conference +from import_xls.excel_settings import event_sett +from django.db import IntegrityError + + +CONF_FILE = settings.MEDIA_ROOT+'/import/conf.xls' +ADDCONF_FILE = settings.MEDIA_ROOT+'/import/add_conf.xls' + + +class Command(BaseCommand): + def handle(self, *args, **options): + + f = open(ADDCONF_FILE, 'r') + book = xlrd.open_workbook(file_contents=f.read()) + sheet = book.sheet_by_index(0) + row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] + labels = [label for label in row_list[0]] + + + existing = 0 + + + for row_number, row in enumerate(row_list[1:]): + if row[0] != '': + try: + object = Conference.objects.language('ru').get(id=int(row[0])) + existing += 1 + except ValueError: + object = Conference() + object.translate('ru') + + except Conference.DoesNotExist: + object = Conference(id= int(row[0])) + object.translate('ru') + existing += 1 + else: + # if id blank - its a new place + object = Conference() + object.translate('ru') + + methods = [] + for col_number, cell in enumerate(row): + label = labels[col_number] + + setting = event_sett.get(label) + + 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') + + if func is not None: + extra_value = setting.get('extra_values') + if extra_value is not None: + # if setting has extra value then + # it is some field like city, theme, tag + # that has relation and can be created + + # in function we add language(need for relation fields) + # and extra value from object (like for city need country) + value = func(cell, 'ru', getattr(object, extra_value)) + elif setting.get('bitfield'): + value = func(object, cell, setting['label']) + + else: + value = func(cell) + + + setattr(object, field_name, value) + + try: + object.save() + except IntegrityError: + print('error %s'% str(object)) + continue + + + print('post save %s'% str(object)) + + + for method in methods: + func = method['func'] + if method.get('purpose'): + try: + func(object, method['value'], method['purpose']) + except: + continue + else: + func(object, method['value']) + diff --git a/conference/management/commands/conf_old.py b/conference/management/commands/conf_old.py new file mode 100644 index 00000000..3ccb0658 --- /dev/null +++ b/conference/management/commands/conf_old.py @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- +import os +import MySQLdb +from MySQLdb.cursors import DictCursor +from django.core.management.base import BaseCommand +from django.conf import settings +from conference.models import Conference +from django.core.files import File +from functions.translate import fill_with_signal +from country.models import Country +from city.models import City + +class Command(BaseCommand): + def handle(self, *args, **options): + db = MySQLdb.connect(host="localhost", + user="expomap", + passwd="7FbLtAGjse", + db="old_db", + charset='utf8', + cursorclass=DictCursor) + cursor = db.cursor() + sql = """ + SELECT products.products_id as id, products_date_added as created, products_last_modified as modified, + discount, expohit, ufi, products_name as name, products_description as description, + products_short_description as main_title, products_viewed as viewed, products_period as period, + products_org as organiser,products_products as products, products_official as web_page, + products_img1 as logo, products_startdate as data_begin, products_enddate as data_end, + url as old_url, places_id + FROM `products` + LEFT JOIN `products_description` ON products.products_id=products_description.products_id + WHERE `products_status` =1 + AND `conference` =1 AND places_id >0 + """ + cursor.execute(sql) + result = cursor.fetchall() + + names = [item['name'] for item in result] + media = settings.MEDIA_ROOT.replace('media/', '') + for i, item in enumerate(result): + name = item['name'] + print('number: %d, name: %s'%(i, name.encode('utf8'))) + if Conference.objects.filter(translations__name=name).exists(): + continue + + data_begin = item['data_begin'] + data_end= item['data_end'] + + + place_id = item['places_id'] # convert to country and city + country, city = get_places(place_id) + #if isinstance(city, unicode): + #print(city.encode('utf8')) + # value = bad_cities.get(city) + # if value: + # bad_cities[city] = value + 1 + # else: + # bad_cities[city] = 1 + + # counter += 1 + # continue + + if not country or not city: + continue + + old_url = item['old_url'] + periodic = item['period'] + periodic = get_periodic(periodic) + web_page = item['web_page'] + currency = 'USD' + expohit = item['expohit'] + ufi = item['ufi'] + if ufi: + ufi = 1 + else: + ufi = 0 + + created = item['created'] + modified = item['modified'] + + + + data = {'name_ru': name, 'main_title_ru': item['main_title'], 'description_ru': item['description'], + 'main_themes_ru': item['products'], 'time_ru': '', 'discount_description_ru': '', 'title_ru': '', + 'descriptions_ru': '', 'keywords_ru': ''} + + conference = Conference(data_begin=data_begin, data_end=data_end, city=city, country=country, + web_page=web_page, old_url=old_url, periodic=periodic, currency=currency, + expohit=expohit, created=created, modified=modified) + try: + fill_with_signal(Conference, conference, data) + except: + continue + print('conference: %s'%str(conference)) + + + + #print(len(bad_cities.keys())) + #print(len(result)) + #print(Conference.objects.filter().count()) + #print(Conference.objects.exclude(translations__name__in=names).count()) + + +def get_periodic(value): + PERIODIC = {u'Ежегодно': 1.0, u'Раз в 2 года': 0.5, u'2 раза в год': 2.0, u'4 раза в год': 4.0, + u'3 раза в год': 3.0, u'Раз в 3 года': 0.33, u'Раз в 4 года': 0.25, u'5 раз в год': 5.0, + u'Раз в два года': 0.5, u'Три раза в год': 3.0} + return PERIODIC.get(value, 0) + +def get_logo(value): + if not value: + return None + if value.startswith('..'): + value = value.replace('..', 'media') + elif value.startswith('/'): + value = 'media'+value + + return value + +def get_places(place_id): + db = MySQLdb.connect(host="localhost", + user="expomap", + passwd="7FbLtAGjse", + db="old_db", + charset='utf8', + cursorclass=DictCursor) + cursor = db.cursor() + sql_city = """ + SELECT title as city_name, url as city_old_url, inflect as city_inflect, parent_id as country_id + FROM `products_places` + WHERE `places_id` =%s + """%place_id + + cursor.execute(sql_city) + result = cursor.fetchone() + city_name, city_old_url, city_inflect = result['city_name'], result['city_old_url'], result['city_inflect'] + country_id = result['country_id'] + if city_name: + city_name = city_name.strip() + if city_name==u'Гонконг': + country = Country.objects.get(id=76) + city = City.objects.get(url='hong-kong') + return (country, city) + + sql_country = """ + SELECT title as country_name, url as country_old_url, inflect as country_inflect + FROM `products_places` + WHERE `places_id` =%s + """%country_id + + cursor.execute(sql_country) + result = cursor.fetchone() + country_name, country_old_url, country_inflect = result['country_name'], result['country_old_url'], result['country_inflect'] + country_name = filter_country(country_name) + try: + country = Country.objects.get(translations__name=country_name) + except Country.DoesNotExist: + country = None + except Country.MultipleObjectsReturned: + country = Country.objects.filter(translations__name=country_name)[0] + + city_name = filter_city(city_name) + try: + city = City.objects.get(translations__name=city_name, country=country) + except City.DoesNotExist: + #city = city_name + city = None + #print(city_name.encode('utf8')) + except City.MultipleObjectsReturned: + city = City.objects.filter(translations__name=city_name, country=country)[0] + #print('----------------') + #print(city_name.encode('utf8')) + #print('----------------') + + + + return (country, city) + +def filter_country(name): + if name == u'ЮАР': + name = u'Южно-Африканская Республика' + elif name == u'Танзания': + name = u'Объединенная Республика Танзания' + elif name == u'Гавайи': + name = u'США' + elif name == u'Бирма': + name = u'Мьянма' + elif name == u'Босния и Герцоговина': + name = u'Босния и Герцеговина' + + return name + +def filter_city(name): + cities = {u'Дели': u'Нью-Дели', u'Дэли': u'Нью-Дели', u'Пуна': u'Пуне', u'Лонг-Бич': u'Лонг Бич', + u'Калифорния': u'Лос-Анджелес', u'Санта-Клара': u'Санта Клара', u'Скотсдейл': u'Скоттсдейл', + u'Пенанг': u'Пинанг', u'Лейк Буэна Виста': u'Лейк-Буэна-Виста', u'Лиллестрём': u'Лиллештром', + u'Хертогенбош': u'Ден Бош', u'Марбелла': u'Марбелья', u'Лилль': u'Лилль', u'Ла Рош-сюр-Форон': u'Ла-Рош-сюр-Форон', + u'Эль-Кувейт': u'Кувейт', u'Харрогит': u'Харрогейт', u'Иокогама': u'Йокогама', u'Палм Бич': u'Палм-Бич', + u'Фрайбург': u'Фрейбург в Брейсгау', u'Колмар': u'Кольмар', u'Мускат': u'Маскат', u'Бад Зальцуфлен': u'Бад-Зальцуфлен'} + new_name = cities.get(name) + if new_name: + return new_name + else: + return name + + + + +""" + # convert logo + logo = item['logo'] + logo = get_logo(logo) + if logo and logo.startswith('media/images'): + file = media + logo + if os.path.isfile(file): + f = open('mytest.pdf') + else: + logo = None +""" \ No newline at end of file diff --git a/settings/management/__init__.py b/settings/management/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/settings/management/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/settings/management/commands/__init__.py b/settings/management/commands/__init__.py new file mode 100644 index 00000000..3ed9fd0f --- /dev/null +++ b/settings/management/commands/__init__.py @@ -0,0 +1 @@ +__author__ = 'root' diff --git a/settings/management/commands/do_inflect.py b/settings/management/commands/do_inflect.py new file mode 100644 index 00000000..601a69a3 --- /dev/null +++ b/settings/management/commands/do_inflect.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from django.core.management.base import BaseCommand, CommandError +from django.conf import settings +import xlrd +from theme.models import Tag, Theme +from city.models import City + +CITIES = settings.MEDIA_ROOT+'/import/cities_inflect.xls' +TAGS = settings.MEDIA_ROOT+'/import/tags_inflect.xls' + + + +class Command(BaseCommand): + def handle(self, *args, **options): + f = open(TAGS, 'r') + book = xlrd.open_workbook(file_contents=f.read()) + sheet = book.sheet_by_index(0) + row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] + print(row_list[2][0]) + for row_number, row in enumerate(row_list[2:]): + url = row[1] + print(url) + inflect = row[3] + if inflect: + Tag.objects.filter(url=url).update(inflect=inflect) + + + + #City.objects.filter(url=url).update(inflect=row[4]) + + + #try: + # city = City.objects.get(id=id) + #except City.DoesNotExist: + # print() + diff --git a/settings/management/commands/update_views_cache.py b/settings/management/commands/update_views_cache.py new file mode 100644 index 00000000..6baafc7b --- /dev/null +++ b/settings/management/commands/update_views_cache.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from django.core.management.base import BaseCommand, CommandError +from django.test.client import RequestFactory +from django.utils import translation +from django.conf import settings +from exposition.views import ExpositionByCity + + + + + + +class Command(BaseCommand): + def handle(self, *args, **options): + langs = [code for code, name in settings.LANGUAGES] + + for lang in langs: + translation.activate(lang) + + request = RequestFactory().get('/expo/city/') + view = ExpositionByCity.as_view() + response = view(request) + print(lang) + + + print('success') diff --git a/static/client.old/img/comments/1.png b/static/client.old/img/comments/1.png new file mode 100644 index 00000000..3783bf41 Binary files /dev/null and b/static/client.old/img/comments/1.png differ diff --git a/static/client.old/img/comments/2.gif b/static/client.old/img/comments/2.gif new file mode 100644 index 00000000..93ad0e60 Binary files /dev/null and b/static/client.old/img/comments/2.gif differ diff --git a/static/client.old/img/comments/3.png b/static/client.old/img/comments/3.png new file mode 100644 index 00000000..d15fa96b Binary files /dev/null and b/static/client.old/img/comments/3.png differ diff --git a/static/client.old/img/comments/4.png b/static/client.old/img/comments/4.png new file mode 100644 index 00000000..f8d250f1 Binary files /dev/null and b/static/client.old/img/comments/4.png differ diff --git a/static/client.old/img/comments/5.jpg b/static/client.old/img/comments/5.jpg new file mode 100644 index 00000000..eee3573d Binary files /dev/null and b/static/client.old/img/comments/5.jpg differ diff --git a/static/client.old/img/comments/PROPHOTOS.png b/static/client.old/img/comments/PROPHOTOS.png new file mode 100644 index 00000000..81a7fe2f Binary files /dev/null and b/static/client.old/img/comments/PROPHOTOS.png differ diff --git a/static/client.old/img/comments/RS Balance.png b/static/client.old/img/comments/RS Balance.png new file mode 100644 index 00000000..edb4924f Binary files /dev/null and b/static/client.old/img/comments/RS Balance.png differ diff --git a/static/client.old/img/comments/Revival RMC.jpg b/static/client.old/img/comments/Revival RMC.jpg new file mode 100644 index 00000000..f53467cb Binary files /dev/null and b/static/client.old/img/comments/Revival RMC.jpg differ diff --git a/static/client.old/img/comments/Sail First.png b/static/client.old/img/comments/Sail First.png new file mode 100644 index 00000000..0ed3009a Binary files /dev/null and b/static/client.old/img/comments/Sail First.png differ diff --git a/static/client.old/img/comments/VEZDEVOZ.png b/static/client.old/img/comments/VEZDEVOZ.png new file mode 100644 index 00000000..072459c5 Binary files /dev/null and b/static/client.old/img/comments/VEZDEVOZ.png differ diff --git a/static/img/soc-medias/icon-fb.png b/static/img/soc-medias/icon-fb.png new file mode 100644 index 00000000..2edee29b Binary files /dev/null and b/static/img/soc-medias/icon-fb.png differ diff --git a/static/img/soc-medias/icon-fb_hover.png b/static/img/soc-medias/icon-fb_hover.png new file mode 100644 index 00000000..ab5d6798 Binary files /dev/null and b/static/img/soc-medias/icon-fb_hover.png differ diff --git a/static/img/soc-medias/icon-goog.png b/static/img/soc-medias/icon-goog.png new file mode 100644 index 00000000..4c7048de Binary files /dev/null and b/static/img/soc-medias/icon-goog.png differ diff --git a/static/img/soc-medias/icon-lin.png b/static/img/soc-medias/icon-lin.png new file mode 100644 index 00000000..99e8ab6d Binary files /dev/null and b/static/img/soc-medias/icon-lin.png differ diff --git a/static/img/soc-medias/icon-lin_hover.png b/static/img/soc-medias/icon-lin_hover.png new file mode 100644 index 00000000..c33719f4 Binary files /dev/null and b/static/img/soc-medias/icon-lin_hover.png differ diff --git a/static/img/soc-medias/icon-mailr.png b/static/img/soc-medias/icon-mailr.png new file mode 100644 index 00000000..1bfee0c3 Binary files /dev/null and b/static/img/soc-medias/icon-mailr.png differ diff --git a/static/img/soc-medias/icon-ok.png b/static/img/soc-medias/icon-ok.png new file mode 100644 index 00000000..e77a9a42 Binary files /dev/null and b/static/img/soc-medias/icon-ok.png differ diff --git a/static/img/soc-medias/icon-twit.png b/static/img/soc-medias/icon-twit.png new file mode 100644 index 00000000..e4dc8c9d Binary files /dev/null and b/static/img/soc-medias/icon-twit.png differ diff --git a/static/img/soc-medias/icon-vk.png b/static/img/soc-medias/icon-vk.png new file mode 100644 index 00000000..b151ec5a Binary files /dev/null and b/static/img/soc-medias/icon-vk.png differ diff --git a/static/img/soc-medias/icon-yand.png b/static/img/soc-medias/icon-yand.png new file mode 100644 index 00000000..6ce829fe Binary files /dev/null and b/static/img/soc-medias/icon-yand.png differ diff --git a/static/img/soc-medias/sm-icon-fb-w.png b/static/img/soc-medias/sm-icon-fb-w.png new file mode 100644 index 00000000..9b5314d7 Binary files /dev/null and b/static/img/soc-medias/sm-icon-fb-w.png differ diff --git a/static/img/soc-medias/sm-icon-fb.png b/static/img/soc-medias/sm-icon-fb.png new file mode 100644 index 00000000..bd286046 Binary files /dev/null and b/static/img/soc-medias/sm-icon-fb.png differ diff --git a/static/img/soc-medias/sm-icon-fb_hover.png b/static/img/soc-medias/sm-icon-fb_hover.png new file mode 100644 index 00000000..ab5d6798 Binary files /dev/null and b/static/img/soc-medias/sm-icon-fb_hover.png differ diff --git a/static/img/soc-medias/sm-icon-lin-w.png b/static/img/soc-medias/sm-icon-lin-w.png new file mode 100644 index 00000000..19b88726 Binary files /dev/null and b/static/img/soc-medias/sm-icon-lin-w.png differ diff --git a/static/img/soc-medias/sm-icon-lin.png b/static/img/soc-medias/sm-icon-lin.png new file mode 100644 index 00000000..6783ffd7 Binary files /dev/null and b/static/img/soc-medias/sm-icon-lin.png differ diff --git a/static/img/soc-medias/sm-icon-lin_hover.png b/static/img/soc-medias/sm-icon-lin_hover.png new file mode 100644 index 00000000..c33719f4 Binary files /dev/null and b/static/img/soc-medias/sm-icon-lin_hover.png differ diff --git a/static/img/soc-medias/sm-icon-rss.png b/static/img/soc-medias/sm-icon-rss.png new file mode 100644 index 00000000..e1aaf8e5 Binary files /dev/null and b/static/img/soc-medias/sm-icon-rss.png differ diff --git a/static/img/soc-medias/sm-icon-twit-w.png b/static/img/soc-medias/sm-icon-twit-w.png new file mode 100644 index 00000000..0aa71157 Binary files /dev/null and b/static/img/soc-medias/sm-icon-twit-w.png differ diff --git a/static/img/soc-medias/sm-icon-twit.png b/static/img/soc-medias/sm-icon-twit.png new file mode 100644 index 00000000..642d994a Binary files /dev/null and b/static/img/soc-medias/sm-icon-twit.png differ diff --git a/static/img/soc-medias/sm-icon-twit_hover.png b/static/img/soc-medias/sm-icon-twit_hover.png new file mode 100644 index 00000000..7b5b587d Binary files /dev/null and b/static/img/soc-medias/sm-icon-twit_hover.png differ diff --git a/static/img/soc-medias/sm-icon-vk-w.png b/static/img/soc-medias/sm-icon-vk-w.png new file mode 100644 index 00000000..34dc48a1 Binary files /dev/null and b/static/img/soc-medias/sm-icon-vk-w.png differ diff --git a/static/img/soc-medias/sm-icon-vk.png b/static/img/soc-medias/sm-icon-vk.png new file mode 100644 index 00000000..99b581c9 Binary files /dev/null and b/static/img/soc-medias/sm-icon-vk.png differ diff --git a/static/img/soc-medias/sm-icon-vk_hover.png b/static/img/soc-medias/sm-icon-vk_hover.png new file mode 100644 index 00000000..c94aee90 Binary files /dev/null and b/static/img/soc-medias/sm-icon-vk_hover.png differ diff --git a/templates/admin/meta/meta_list.html b/templates/admin/meta/meta_list.html new file mode 100644 index 00000000..d3eb5384 --- /dev/null +++ b/templates/admin/meta/meta_list.html @@ -0,0 +1,59 @@ +{% extends 'admin_list.html' %} +{% load static %} + +{% block body %} + +
+
+

Фильтры

+
+
+
+ {{ form }} + + +
+
+ +
+ +
+
+

Список мета настроек

+
+
+ + + + + + + + + + + {% for item in object_list %} + + + + + + + + + + + + {% endfor %} + +
idСтраница 
{{ item.id }}{{ item.name }} + + Изменить + +
+ Добавить настройку +
+ {# pagination #} + {% include 'admin/includes/admin_pagination.html' with page_obj=object_list %} +
+{% endblock %} \ No newline at end of file diff --git a/templates/admin/meta/meta_setting.html b/templates/admin/meta/meta_setting.html new file mode 100644 index 00000000..187e4658 --- /dev/null +++ b/templates/admin/meta/meta_setting.html @@ -0,0 +1,60 @@ +{% extends 'base.html' %} +{% load static %} +{# Displays article form #} + + {% block scripts %} + + + {# selects #} + + + + {# ajax #} + + + + {% endblock %} + +{% block body %} +
{% csrf_token %} +
+ {% if article %} Изменить {% else %} Добавить {% endif %}настройку{% if article %}(на сайте){% endif %} + +
+
+

+
+
+ {# name #} +
+ +
+ {{ form.name }} + {{ form.name.errors }} +
+
+ + {# title #} + {% include 'admin/forms/multilang.html' with field='title' form=form languages=languages %} + + + {# description #} + {% include 'admin/forms/multilang.html' with field='description' form=form languages=languages %} + {# keywords #} + {% include 'admin/forms/multilang.html' with field='keywords' form=form languages=languages %} + {# title #} + {% include 'admin/forms/multilang.html' with field='h1' form=form languages=languages %} + +
+ +
+ +
+ + + +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/client/conference/catalog.html b/templates/client/conference/catalog.html new file mode 100644 index 00000000..bac0aa8b --- /dev/null +++ b/templates/client/conference/catalog.html @@ -0,0 +1,40 @@ +{% extends 'base_catalog.html' %} +{% load template_filters %} +{% load i18n %} + +{% block bread_scrumbs %} + +{% endblock %} + + +{% block page_title %} +
+

{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Конференции' %}: {{ filter_object.name }}{% endif %}

+
+ + {% include 'includes/exposition/catalog_filter_period.html' %} + +{% endblock %} + +{% block content_list %} + {% include 'includes/conference/conference_list.html' with object_list=object_list %} +{% endblock %} + +{% block paginator %} + {% include 'includes/catalog_paginator.html' with page_obj=page_obj %} +{% endblock %} \ No newline at end of file diff --git a/templates/client/conference/catalog_theme.html b/templates/client/conference/catalog_theme.html new file mode 100644 index 00000000..bb249f3d --- /dev/null +++ b/templates/client/conference/catalog_theme.html @@ -0,0 +1,65 @@ +{% extends 'base_catalog.html' %} +{% load template_filters %} +{% load i18n %} + +{% block bread_scrumbs %} + +{% endblock %} + + +{% block page_title %} +
+

{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Конференции' %}: {{ filter_object.name }}{% endif %}

+
+ + {% include 'includes/exposition/catalog_filter_period.html' %} + +{% endblock %} + +{% block content_list %} + {% include 'includes/conference/conference_list.html' with object_list=object_list %} +{% endblock %} + +{% block paginator %} + {% include 'includes/catalog_paginator.html' with page_obj=page_obj %} +{% endblock %} \ No newline at end of file diff --git a/templates/client/conference/conference_by.html b/templates/client/conference/conference_by.html new file mode 100644 index 00000000..7c14825d --- /dev/null +++ b/templates/client/conference/conference_by.html @@ -0,0 +1,42 @@ +{% extends 'base_catalog.html' %} +{% load static %} +{% load i18n %} +{% load template_filters %} + +{% block style %} + +{% endblock %} + + +{% block bread_scrumbs %} + +{% endblock %} + +{% block page_title %} +
+

{{ title2 }}:

+
+{% endblock %} + +{% block content_list %} + {% for obj in object_list %} + {% set cur_word = obj.name %} + {% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower and forloop.counter != 1 %} + + {% endif %} + {% if cur_word|slice:":1"|lower != prev_word|slice:":1"|lower %} +