refactor accounts

remotes/origin/1203
Nazar Kotjuk 10 years ago
parent 898b0b7a9a
commit 00d4420bc8
  1. 32
      accounts/edit_forms.py
  2. 74
      accounts/forms.py
  3. 1
      accounts/management/__init__.py
  4. 1
      accounts/management/commands/__init__.py
  5. 82
      accounts/management/commands/load_accounts.py
  6. 127
      accounts/models.py
  7. 21
      accounts/search_indexes.py
  8. 22
      accounts/urls.py
  9. 7
      accounts/user_catalog_urls.py
  10. 117
      accounts/views.py
  11. 1
      company/management/__init__.py
  12. 1
      company/management/commands/__init__.py
  13. 97
      company/management/commands/company_from_old_db.py
  14. 77
      company/management/commands/company_test.py
  15. 20
      functions/views_help.py
  16. 2
      import_xls/excel_settings.py
  17. 26
      registration/backends/default/views.py
  18. 11
      templates/client/accounts/feed.html
  19. 481
      templates/client/accounts/fill_company.html
  20. 2
      templates/client/accounts/messages.html
  21. 436
      templates/client/accounts/new_profile.html
  22. 366
      templates/client/accounts/profile.html

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# forms for editing user data
from django import forms from django import forms
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from models import User, Profile from models import User, Profile
@ -6,13 +7,16 @@ from country.models import Country
from city.models import City from city.models import City
from company.models import Company from company.models import Company
class AvatarForm(forms.ModelForm): class AvatarForm(forms.ModelForm):
avatar = forms.ImageField(label=_(u'Выберите файл (GIF, JPG, PNG. Размер 100 × 100 пикселей)'), avatar = forms.ImageField(label=_(u'Выберите файл (GIF, JPG, PNG. Размер 100 × 100 пикселей)'),
required=False, widget=forms.FileInput(attrs={'class': 'input'})) required=False, widget=forms.FileInput(attrs={'class': 'input'}))
class Meta: class Meta:
model = Profile model = Profile
fields = ('avatar',) fields = ('avatar',)
class NameForm(forms.ModelForm): class NameForm(forms.ModelForm):
first_name = forms.CharField(label=_(u'Введите ваше имя')) first_name = forms.CharField(label=_(u'Введите ваше имя'))
last_name = forms.CharField(label=_(u'Введите вашу фамилию')) last_name = forms.CharField(label=_(u'Введите вашу фамилию'))
@ -22,17 +26,19 @@ class NameForm(forms.ModelForm):
fields = ('first_name', 'last_name') fields = ('first_name', 'last_name')
def get_full_name(self): def get_full_name(self):
return u'%s %s'%(self.instance.first_name, self.instance.last_name,) return u'%s %s' % (self.instance.first_name, self.instance.last_name,)
class HomeForm(forms.ModelForm): class HomeForm(forms.ModelForm):
city = forms.CharField(label='Город', required=False, city = forms.CharField(label='Город', required=False,
widget=forms.HiddenInput(attrs={'class': 'select2'})) widget=forms.HiddenInput(attrs={'class': 'select2'}))
country = forms.ChoiceField(label=_(u'Страна'), choices=[(c.id, c.name) for c in Country.objects.all()], required=False, country = forms.ChoiceField(label=_(u'Страна'), choices=[(c.id, c.name) for c in Country.objects.all()],
widget=forms.Select(attrs={'class': 'select2'})) required=False, widget=forms.Select(attrs={'class': 'select2'}))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(HomeForm, self).__init__(*args, **kwargs) super(HomeForm, self).__init__(*args, **kwargs)
if self.instance.city: if self.instance.city:
# city uses ajax select2 widget
self.fields['city'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.city.name}) self.fields['city'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.city.name})
class Meta: class Meta:
@ -48,7 +54,6 @@ class HomeForm(forms.ModelForm):
except City.DoesNotExist: except City.DoesNotExist:
return None return None
def clean_country(self): def clean_country(self):
try: try:
return Country.objects.get(id=self.cleaned_data['country']) return Country.objects.get(id=self.cleaned_data['country'])
@ -56,19 +61,18 @@ class HomeForm(forms.ModelForm):
return None return None
class WorkForm(forms.ModelForm): class WorkForm(forms.ModelForm):
position = forms.CharField(label=_(u'Укажите вашу должность'), position = forms.CharField(label=_(u'Укажите вашу должность'),
required=False, widget=forms.TextInput()) required=False, widget=forms.TextInput())
company = forms.CharField(label=_(u'Укажите вашу компанию'), required=False, company = forms.CharField(label=_(u'Укажите вашу компанию'), required=False,
widget=forms.HiddenInput(attrs={'class': 'select2'})) widget=forms.HiddenInput(attrs={'class': 'select2'}))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(WorkForm, self).__init__(*args, **kwargs) super(WorkForm, self).__init__(*args, **kwargs)
if self.instance.company: if self.instance.company:
# for ajax select2 widget
self.fields['company'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.company.name}) self.fields['company'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.company.name})
class Meta: class Meta:
model = User model = User
fields = ('position', 'company') fields = ('position', 'company')
@ -84,7 +88,8 @@ class WorkForm(forms.ModelForm):
class AboutCompanyForm(forms.ModelForm): class AboutCompanyForm(forms.ModelForm):
about_company = forms.CharField(label=_(u'Описание компании'), required=False, about_company = forms.CharField(label=_(u'Описание компании'), required=False,
widget=forms.Textarea(attrs={'cols':'30'})) widget=forms.Textarea(attrs={'cols': '30'}))
class Meta: class Meta:
model = Profile model = Profile
fields = ('about_company',) fields = ('about_company',)
@ -99,11 +104,11 @@ class PhoneForm(forms.ModelForm):
fields = ('phone', 'show_phone') fields = ('phone', 'show_phone')
def clean_phone(self): def clean_phone(self):
phone = self.cleaned_data['phone'] phone = self.cleaned_data['phone']
if not phone: if not phone:
return return
deduct = ('-','(',')','.',' ', '+') deduct = ('-', '(', ')', '.', ' ', '+')
for elem in deduct: for elem in deduct:
phone = phone.replace(elem, '') phone = phone.replace(elem, '')
if phone.isdigit(): if phone.isdigit():
@ -112,7 +117,6 @@ class PhoneForm(forms.ModelForm):
raise forms.ValidationError(_(u'Введите правильный телефон')) raise forms.ValidationError(_(u'Введите правильный телефон'))
class EmailForm(forms.ModelForm): class EmailForm(forms.ModelForm):
email = forms.EmailField(label=_(u'Ваш e-mail'), required=False) email = forms.EmailField(label=_(u'Ваш e-mail'), required=False)
@ -120,6 +124,7 @@ class EmailForm(forms.ModelForm):
model = User model = User
fields = ('email',) fields = ('email',)
class WebPageForm(forms.ModelForm): class WebPageForm(forms.ModelForm):
web_page = forms.URLField(label=_(u'Адрес вашего сайта'), required=False) web_page = forms.URLField(label=_(u'Адрес вашего сайта'), required=False)
@ -127,17 +132,18 @@ class WebPageForm(forms.ModelForm):
model = User model = User
fields = ('web_page',) fields = ('web_page',)
class SocialForm(forms.ModelForm): class SocialForm(forms.ModelForm):
facebook = forms.CharField(label=_(u'Facebook'), required=False) facebook = forms.CharField(label=_(u'Facebook'), required=False)
twitter = forms.CharField(label=_(u'Twitter'), required=False) twitter = forms.CharField(label=_(u'Twitter'), required=False)
vk = forms.CharField(label=_(u'В контакте'), required=False) vk = forms.CharField(label=_(u'В контакте'), required=False)
linkedin = forms.CharField(label=_(u'LinkedIn'), required=False) linkedin = forms.CharField(label=_(u'LinkedIn'), required=False)
class Meta: class Meta:
model = Profile model = Profile
fields = ('facebook', 'twitter', 'vk', 'linkedin') fields = ('facebook', 'twitter', 'vk', 'linkedin')
class AboutForm(forms.ModelForm): class AboutForm(forms.ModelForm):
about = forms.CharField(label=_(u'Немного о себе'), required=False, about = forms.CharField(label=_(u'Немного о себе'), required=False,
widget=forms.Textarea(attrs={'cols':'30'})) widget=forms.Textarea(attrs={'cols':'30'}))

@ -6,16 +6,14 @@ from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.forms.util import ErrorList from django.forms.util import ErrorList
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.conf import settings from django.conf import settings
from models import User, Profile from models import User
from django.db.models import Q
from theme.models import Theme, Tag from theme.models import Theme, Tag
from country.models import Area from country.models import Area
from django.utils import translation
from country.models import Country from country.models import Country
from city.models import City from city.models import City
from company.models import Company from company.models import Company
from organiser.models import Organiser from functions.form_check import is_latin
# functions
from functions.form_check import translit_with_separator, is_latin
def clean_relation_field(inst, field_name, model): def clean_relation_field(inst, field_name, model):
@ -137,17 +135,6 @@ class UserForm(forms.ModelForm):
profile.save() profile.save()
return user return user
#def clean_url(self):
# url = self.cleaned_data.get('url')
# if url:
# if User.objects.get(url=translit_with_separator(url)):
# raise forms.ValidationError('Такой урл уже занят')
# else:
# return url
#def clean_organiser(self):
# return clean_relation_field(self, 'organiser', Organiser)
def clean_company(self): def clean_company(self):
return clean_relation_field(self, 'company', Company) return clean_relation_field(self, 'company', Company)
@ -174,21 +161,6 @@ class UserForm(forms.ModelForm):
else: else:
raise forms.ValidationError('Введите правильный код страны') raise forms.ValidationError('Введите правильный код страны')
"""
def clean_web_page(self):
cleaned_data = super(UserForm, self).clean()
web_page = cleaned_data.get('web_page')
if not web_page:
return web_page
import socket
try:
socket.getaddrinfo(web_page, 80)
return web_page
except:
return forms.ValidationError('Введите правильный адрес страници')
"""
class ChangePasswordForm(forms.Form): class ChangePasswordForm(forms.Form):
""" """
@ -319,24 +291,6 @@ class SocialRegistrationCompleteForm(RegistrationCompleteForm):
return user return user
class RecoveryForm(forms.Form):
email = forms.EmailField(widget=forms.TextInput(attrs={'placeholder': _(u'Email')}))
def get_user(self):
email = self.cleaned_data['email']
return User.objects.get(email=email)
def clean_email(self):
email = self.cleaned_data['email']
try:
return User.objects.get(email=email)
except User.DoesNotExist:
raise forms.ValidationError(_(u'Пользователь с таким емейлом не зарегестрирован'))
from django.db.models import Q
class UserFilterForm(forms.Form): class UserFilterForm(forms.Form):
model = User model = User
search_req = forms.CharField(label=_(u'Введите e-mail, имя или фамилию для запроса'), required=False) search_req = forms.CharField(label=_(u'Введите e-mail, имя или фамилию для запроса'), required=False)
@ -450,21 +404,21 @@ class FeedFilterForm(forms.Form):
area = self.cleaned_data['area'] area = self.cleaned_data['area']
country = self.cleaned_data['co'] country = self.cleaned_data['co']
city = self.cleaned_data['ci'] city = self.cleaned_data['ci']
filter = self.filter filter_obj = self.filter
filter.theme.clear() filter_obj.theme.clear()
filter.theme.add(*Theme.objects.filter(id__in=theme)) filter_obj.theme.add(*Theme.objects.filter(id__in=theme))
filter.tag.clear() filter_obj.tag.clear()
filter.tag.add(*Tag.objects.filter(id__in=tag)) filter_obj.tag.add(*Tag.objects.filter(id__in=tag))
filter.area.clear() filter_obj.area.clear()
filter.area.add(*Area.objects.filter(id__in=area)) filter_obj.area.add(*Area.objects.filter(id__in=area))
filter.country.clear() filter_obj.country.clear()
filter.country.add(*Country.objects.filter(id__in=country)) filter_obj.country.add(*Country.objects.filter(id__in=country))
filter.city.clear() filter_obj.city.clear()
filter.city.add(*City.objects.filter(id__in=city)) filter_obj.city.add(*City.objects.filter(id__in=city))
def clean_tg(self): def clean_tg(self):

@ -1 +0,0 @@
__author__ = 'root'

@ -1,82 +0,0 @@
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()

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import random, string
from django.db import models from django.db import models
from django.core.validators import email_re
from django.db.models import Q from django.db.models import Q
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, PermissionsMixin from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, PermissionsMixin
from django.core.mail import send_mail from django.core.mail import send_mail
@ -9,19 +7,9 @@ from django.utils import timezone
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.db.models.loading import get_model from django.db.models.loading import get_model
#custom functions
from functions.form_check import translit_with_separator from functions.form_check import translit_with_separator
"""
from django.contrib.auth.hashers import check_password
from hashlib import md5
from django.contrib.auth import get_user_model
from django.db.models import get_model
"""
class UserManager(BaseUserManager): class UserManager(BaseUserManager):
""" """
Creates and saves a User with the given email, first_name, last_name and password. Creates and saves a User with the given email, first_name, last_name and password.
@ -31,10 +19,10 @@ class UserManager(BaseUserManager):
if not email: if not email:
raise ValueError('Вы должни ввести электронную почту') raise ValueError('Вы должни ввести электронную почту')
user= self.model( user = self.model(
email = UserManager.normalize_email(email), email=UserManager.normalize_email(email),
first_name = first_name,last_name = last_name, first_name=first_name,last_name = last_name,
username = UserManager.normalize_email(email), username=UserManager.normalize_email(email),
is_staff=False, is_active=False, is_superuser=False, is_staff=False, is_active=False, is_superuser=False,
last_login=now, date_joined=now, **extra_fields last_login=now, date_joined=now, **extra_fields
) )
@ -43,29 +31,6 @@ class UserManager(BaseUserManager):
user.save(using=self._db) user.save(using=self._db)
return user return user
def create_social_user(self, username, first_name, last_name, password=None, **extra_fields):
now = timezone.now()
# generate random password
digits = random.sample(('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), 4)
chars = random.sample(string.lowercase[:], 4)
password = chars + digits
random.shuffle(password)
password = ''.join(password)
user= self.model(first_name=first_name, last_name=last_name, username=username,
is_staff=False, is_active=True, is_superuser=False,
last_login=now, date_joined=now, **extra_fields)
check = True if email_re.match(username) else False
if check:
user.email = UserManager.normalize_email(username)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, username, first_name, last_name, password, **extra_fields): def create_superuser(self, username, first_name, last_name, password, **extra_fields):
if not username: if not username:
raise ValueError('Вы должни ввести электронную почту') raise ValueError('Вы должни ввести электронную почту')
@ -73,9 +38,9 @@ class UserManager(BaseUserManager):
username = UserManager.normalize_email(username) username = UserManager.normalize_email(username)
user = self.create_user( user = self.create_user(
email = username, email=username,
first_name = first_name,last_name = last_name, first_name=first_name, last_name=last_name,
password = password, **extra_fields password=password, **extra_fields
) )
user.is_staff = True user.is_staff = True
@ -85,7 +50,6 @@ class UserManager(BaseUserManager):
user.save(using=self._db) user.save(using=self._db)
return user return user
def safe_get(self, **kwargs): def safe_get(self, **kwargs):
model = self.model model = self.model
try: try:
@ -108,23 +72,21 @@ class User(AbstractBaseUser, PermissionsMixin):
catalog = '/user/' catalog = '/user/'
email = models.EmailField( email = models.EmailField(
verbose_name = u'Email', verbose_name=u'Email',
max_length = 255, max_length=255,
#unique = True, #unique = True,
db_index = True, db_index=True,
) )
username = models.CharField(verbose_name='Email', max_length=255, unique=True, db_index=True) username = models.CharField(verbose_name='Email', max_length=255, unique=True, db_index=True)
first_name = models.CharField(verbose_name='First name', max_length=255) first_name = models.CharField(verbose_name='First name', max_length=255)
last_name = models.CharField(verbose_name='Last name', max_length=255) last_name = models.CharField(verbose_name='Last name', max_length=255)
rating = models.IntegerField(default=100)# добавить индекс в базе rating = models.IntegerField(default=100)# добавить индекс в базе
url = models.SlugField(blank=True)#, unique=True, null=True) url = models.SlugField(blank=True)
# is_active = models.BooleanField(default=0)
is_active = models.BooleanField(default=0) # СДЕЛАТЬ проверку на емейле
is_staff = models.BooleanField(default=0) is_staff = models.BooleanField(default=0)
is_admin = models.BooleanField(default=0) is_admin = models.BooleanField(default=0)
date_joined = models.DateTimeField(auto_now_add=True) date_joined = models.DateTimeField(auto_now_add=True)
date_registered = models.DateTimeField(blank=True, null=True)# date_registered = models.DateTimeField(blank=True, null=True)
date_modified = models.DateTimeField(auto_now=True) date_modified = models.DateTimeField(auto_now=True)
#relations #relations
organiser = models.ForeignKey('organiser.Organiser', verbose_name='Организатор', blank=True, null=True, organiser = models.ForeignKey('organiser.Organiser', verbose_name='Организатор', blank=True, null=True,
@ -142,10 +104,7 @@ class User(AbstractBaseUser, PermissionsMixin):
REQUIRED_FIELDS = ['first_name', 'last_name'] REQUIRED_FIELDS = ['first_name', 'last_name']
class Meta: class Meta:
ordering=['-rating'] ordering = ['-rating']
def is_organiser(self):
return bool(self.organiser)
def get_full_name(self): def get_full_name(self):
""" """
@ -154,16 +113,13 @@ class User(AbstractBaseUser, PermissionsMixin):
return u'%s %s'%(self.first_name, self.last_name) return u'%s %s'%(self.first_name, self.last_name)
def set_url(self, st): def set_url(self, st):
"""
"""
self.url = translit_with_separator(u'%s'%st) self.url = translit_with_separator(u'%s'%st)
def __unicode__(self): def __unicode__(self):
return self.email return self.email
def get_short_name(self): def get_short_name(self):
"Returns the short name for the user." """Returns the short name for the user."""
return self.first_name return self.first_name
def email_user(self, subject, message, from_email=None): def email_user(self, subject, message, from_email=None):
@ -172,7 +128,6 @@ class User(AbstractBaseUser, PermissionsMixin):
""" """
send_mail(subject, message, from_email, [self.email]) send_mail(subject, message, from_email, [self.email])
def has_perm(self, perm, obj=None): def has_perm(self, perm, obj=None):
return True return True
@ -201,62 +156,37 @@ class User(AbstractBaseUser, PermissionsMixin):
return n return n
def get_permanent_url(self): def get_permanent_url(self):
if self.url:
return '/%s/'%self.url
#return self.catalog+self.url+'/'
return '/%d/'%self.id
#return self.catalog+str(self.id)+'/'
def get_translator_url(self):
if self.url: if self.url:
return '/translators/%s/'%self.url return '/%s/' % self.url
return '/translators/%d/'%self.id return '/%d/' % self.id
def get_expos(self): def get_expos(self):
""" """
return information about expos and them related data by 1 query return information about expos and them related data by 1 query(reverse connection)
""" """
return self.exposition_users.language().select_related('country', 'city', 'place').all() return self.exposition_users.language().select_related('country', 'city', 'place').all()
def get_confs(self): def get_confs(self):
""" """
return information about confs and them related data by 1 query return information about confs and them related data by 1 query(reverse connection)
""" """
return self.conference_users.language().select_related('country', 'city', 'place').all() return self.conference_users.language().select_related('country', 'city', 'place').all()
def get_seminars(self):
"""
return information about seminars and them related data by 1 query
"""
return self.seminar_users.language().select_related('country', 'city').all()
def remove_from_calendar(self, data): def remove_from_calendar(self, data):
expo = data['expo'] expo = data['expo']
conf = data['conf'] conf = data['conf']
seminar = data['seminar']
webinar = data['webinar']
calendar = self.calendar calendar = self.calendar
if expo: if expo:
calendar.expositions.remove(*expo) calendar.expositions.remove(*expo)
if conf: if conf:
calendar.conferences.remove(*conf) calendar.conferences.remove(*conf)
if seminar:
calendar.seminars.remove(*seminar)
if webinar:
calendar.webinars.remove(*webinar)
class Profile(models.Model): class Profile(models.Model):
""" """
stores additional information about users stores additional information about users
""" """
user = models.OneToOneField(User) user = models.OneToOneField(User)
country = models.ForeignKey('country.Country', verbose_name='Страна', blank=True, null=True, country = models.ForeignKey('country.Country', verbose_name='Страна', blank=True, null=True,
@ -264,7 +194,6 @@ class Profile(models.Model):
city = models.ForeignKey('city.City', verbose_name='Город', blank=True, null=True, city = models.ForeignKey('city.City', verbose_name='Город', blank=True, null=True,
on_delete=models.PROTECT) on_delete=models.PROTECT)
about_company = models.TextField(verbose_name=_(u'Описание компании'), blank=True) about_company = models.TextField(verbose_name=_(u'Описание компании'), blank=True)
phone = models.BigIntegerField(verbose_name=_(u'Телефон'), blank=True, null=True) phone = models.BigIntegerField(verbose_name=_(u'Телефон'), blank=True, null=True)
show_phone = models.NullBooleanField(verbose_name=_(u'Показывать телефон'), blank=True, null=True, default=1) show_phone = models.NullBooleanField(verbose_name=_(u'Показывать телефон'), blank=True, null=True, default=1)
web_page = models.URLField(verbose_name='Вебсайт',blank=True) web_page = models.URLField(verbose_name='Вебсайт',blank=True)
@ -275,7 +204,6 @@ class Profile(models.Model):
twitter = models.URLField(verbose_name=_(u'Twitter'), blank=True,max_length=255) twitter = models.URLField(verbose_name=_(u'Twitter'), blank=True,max_length=255)
linkedin = models.URLField(verbose_name=_(u'LinkedIn'), blank=True, max_length=255) linkedin = models.URLField(verbose_name=_(u'LinkedIn'), blank=True, max_length=255)
vk = models.URLField(verbose_name=_(u'В контакте'), blank=True, max_length=255) vk = models.URLField(verbose_name=_(u'В контакте'), blank=True, max_length=255)
# meta # meta
title = models.CharField(max_length=255, blank=True) title = models.CharField(max_length=255, blank=True)
descriptions = models.CharField(max_length=255, blank=True) descriptions = models.CharField(max_length=255, blank=True)
@ -354,6 +282,9 @@ class EventFilter(models.Model):
to = models.DateField(blank=True, null=True) to = models.DateField(blank=True, null=True)
def get_queryset(self): def get_queryset(self):
"""
get filtered queryset
"""
Exposition = get_model('exposition', 'Exposition') Exposition = get_model('exposition', 'Exposition')
qs = Exposition.enable.upcoming() qs = Exposition.enable.upcoming()
themes = self.theme.all() themes = self.theme.all()
@ -380,9 +311,11 @@ class EventFilter(models.Model):
return qs.order_by('data_begin') return qs.order_by('data_begin')
def calculate_rating(user): def calculate_rating(user):
"""
calculates user rating depending og user filled information
calls in post save signal of profile model
"""
user_rating_fields = {'position': 5, 'company': 5, 'url': 10} user_rating_fields = {'position': 5, 'company': 5, 'url': 10}
profile_rating_fields = {'country': 5, 'city': 5, 'phone': 10, 'facebook': 5, 'twitter': 5, 'linkedin': 5, 'vk': 5, profile_rating_fields = {'country': 5, 'city': 5, 'phone': 10, 'facebook': 5, 'twitter': 5, 'linkedin': 5, 'vk': 5,
'web_page': 10, 'avatar': 20, 'about': 15} 'web_page': 10, 'avatar': 20, 'about': 15}
@ -396,7 +329,6 @@ def calculate_rating(user):
if getattr(user, key): if getattr(user, key):
rating += value rating += value
for key, value in profile_rating_fields.iteritems(): for key, value in profile_rating_fields.iteritems():
if getattr(user.profile, key): if getattr(user.profile, key):
rating += value rating += value
@ -409,6 +341,9 @@ def calculate_rating(user):
def create_user_inf(sender, instance, created, **kwargs): def create_user_inf(sender, instance, created, **kwargs):
"""
create default models that is required for users
"""
if created: if created:
Calendar.objects.create(user=instance) Calendar.objects.create(user=instance)
Profile.objects.create(user=instance) Profile.objects.create(user=instance)
@ -416,10 +351,10 @@ def create_user_inf(sender, instance, created, **kwargs):
calculate_rating(instance) calculate_rating(instance)
def post_profile(sender, instance, created, **kwargs): def post_profile(sender, instance, created, **kwargs):
user = instance.user user = instance.user
calculate_rating(user) calculate_rating(user)
post_save.connect(create_user_inf, sender=User) post_save.connect(create_user_inf, sender=User)
post_save.connect(post_profile, sender=Profile) post_save.connect(post_profile, sender=Profile)

@ -1,21 +0,0 @@
from haystack import indexes
from models import User
"""
class UserIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
# first_name = indexes.CharField(model_attr='first_name')
# last_name = indexes.CharField(model_attr='last_name')
email = indexes.NgramField(model_attr='email')
#email = indexes.CharField(model_attr='email')
def get_model(self):
return User
def index_queryset(self, using=None):
return self.get_model().objects.filter(is_active=True)
"""

@ -1,18 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from views import SettingsView, ProfileView, CalendarView, UserView, UserExpositionsView, UserConferenceView, UserSeminarView from views import SettingsView, CalendarView
from views import NameView, HomeView, AvatarView, WorkView, AboutCompanyView, PhoneView, WebPageView,\ from views import NameView, HomeView, AvatarView, WorkView, AboutCompanyView, PhoneView, WebPageView,\
SocialView, AboutView, ProfileCompanyView, Feed SocialView, AboutView, ProfileCompanyView, Feed
#
from django.http import HttpResponse
def test(request):
return HttpResponse('123')
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^profile/$', login_required(ProfileView.as_view())),
url(r'^profile/company/$', login_required(ProfileCompanyView.as_view())), url(r'^profile/company/$', login_required(ProfileCompanyView.as_view())),
url(r'^profile/settings/$', login_required(SettingsView.as_view())), url(r'^profile/settings/$', login_required(SettingsView.as_view())),
url(r'^profile/calendar/remove/$', 'accounts.views.remove_from_calendar'), url(r'^profile/calendar/remove/$', 'accounts.views.remove_from_calendar'),
@ -20,20 +14,8 @@ urlpatterns = patterns('',
url(r'^profile/calendar/$', login_required(CalendarView.as_view())), url(r'^profile/calendar/$', login_required(CalendarView.as_view())),
url(r'^profile/feed/page/(?P<page>\d+)/$', Feed.as_view()), url(r'^profile/feed/page/(?P<page>\d+)/$', Feed.as_view()),
url(r'^profile/feed/$', login_required(Feed.as_view())), url(r'^profile/feed/$', login_required(Feed.as_view())),
url(r'^user/(?P<url>.*)/expositions/(?P<page>\d+)/$', UserExpositionsView.as_view()),
url(r'^user/(?P<url>.*)/expositions/$', UserExpositionsView.as_view()),
url(r'^user/(?P<url>.*)/seminars/(?P<page>\d+)/$', UserSeminarView.as_view()),
url(r'^user/(?P<url>.*)/seminars/$', UserSeminarView.as_view()),
url(r'^user/(?P<url>.*)/conferences/(?P<page>\d+)/$', UserConferenceView.as_view()),
url(r'^user/(?P<url>.*)/conferences/$', UserConferenceView.as_view()),
url(r'^user/(?P<url>.*)/events/(?P<page>\d+)/$', UserView.as_view()),
url(r'^user/(?P<url>.*)/events/$', UserView.as_view()),
url(r'^user/(?P<url>.*)/$', UserView.as_view()),
url(r'^inactive-user/$', 'registration.backends.default.views.inactive_user_message'), url(r'^inactive-user/$', 'registration.backends.default.views.inactive_user_message'),
#url(r'^profile/messages/(?P<user>.*)/$', login_required(MessagesView.as_view())),
#url(r'^profile/messages/$', login_required(MessagesView.as_view())),
# ajax # ajax
url(r'^profile/update/name/$', login_required(NameView.as_view())), url(r'^profile/update/name/$', login_required(NameView.as_view())),
url(r'^profile/update/home/$', login_required(HomeView.as_view())), url(r'^profile/update/home/$', login_required(HomeView.as_view())),
@ -46,4 +28,4 @@ urlpatterns = patterns('',
url(r'^profile/update/about/$', login_required(AboutView.as_view())), url(r'^profile/update/about/$', login_required(AboutView.as_view())),
url(r'^profile/change-password/', 'accounts.views.change_password'), url(r'^profile/change-password/', 'accounts.views.change_password'),
) )

@ -1,16 +1,11 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required from views import UserView, UserExpositionsView, UserConferenceView
from views import SettingsView, ProfileView, CalendarView, UserView, UserExpositionsView, UserConferenceView, UserSeminarView
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^(?P<url>.*)/expositions/(?P<page>\d+)/$', UserExpositionsView.as_view(), {'meta_id': 72}), url(r'^(?P<url>.*)/expositions/(?P<page>\d+)/$', UserExpositionsView.as_view(), {'meta_id': 72}),
url(r'^(?P<url>.*)/expositions/$', UserExpositionsView.as_view(), {'meta_id': 72}), url(r'^(?P<url>.*)/expositions/$', UserExpositionsView.as_view(), {'meta_id': 72}),
url(r'^(?P<url>.*)/seminars/(?P<page>\d+)/$', UserSeminarView.as_view()),
url(r'^(?P<url>.*)/seminars/$', UserSeminarView.as_view()),
url(r'^(?P<url>.*)/conferences/(?P<page>\d+)/$', UserConferenceView.as_view(), {'meta_id': 73}), url(r'^(?P<url>.*)/conferences/(?P<page>\d+)/$', UserConferenceView.as_view(), {'meta_id': 73}),
url(r'^(?P<url>.*)/conferences/$', UserConferenceView.as_view(), {'meta_id': 73}), url(r'^(?P<url>.*)/conferences/$', UserConferenceView.as_view(), {'meta_id': 73}),
url(r'^(?P<url>.*)/events/(?P<page>\d+)/$', UserView.as_view()),
url(r'^(?P<url>.*)/events/$', UserView.as_view()),
url(r'^(?P<url>.*)/$', UserView.as_view(), {'meta_id': 71}), url(r'^(?P<url>.*)/$', UserView.as_view(), {'meta_id': 71}),
) )

@ -1,22 +1,29 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import dateutil.relativedelta as rdelta import dateutil.relativedelta as rdelta
import json, datetime import json
import datetime
import calendar as python_calendar import calendar as python_calendar
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _, get_language from django.utils.translation import ugettext as _, get_language
from django.utils import timezone
from django_messages.forms import SendForm from django_messages.forms import SendForm
from django.views.generic import TemplateView, FormView from django.views.generic import TemplateView, FormView
from django.conf import settings
from functions.custom_views import ListView from functions.custom_views import ListView
from functions.views_help import dates_range, get_user
from sorl.thumbnail import get_thumbnail from sorl.thumbnail import get_thumbnail
from exposition.models import Exposition
from .forms import ChangePasswordForm, EmailAnnouncementForm, FeedFilterForm from .forms import ChangePasswordForm, EmailAnnouncementForm, FeedFilterForm
from company.forms import CreateCompanyForm from company.forms import CreateCompanyForm
from .models import User from .models import User
from .edit_forms import AvatarForm, NameForm, HomeForm, WorkForm, AboutCompanyForm, PhoneForm, EmailForm,\ from .edit_forms import AvatarForm, NameForm, HomeForm, WorkForm, AboutCompanyForm, PhoneForm, EmailForm,\
WebPageForm, SocialForm, AboutForm WebPageForm, SocialForm, AboutForm
from company.edit_forms import NameForm as CompNameForm, HomeForm as CompHomeForm, PhoneForm as CompPhoneForm,\
EmailForm as CompEmailForm, WebPageForm as CompWebPageForm, SocialForm as CompSocialForm,\
TagForm as CompTagForm, DescriptionForm as CompDescr, StaffForm as CompStaff, \
FoundationForm as CompFound, SpecializationForm as CompSpec, AddressForm as CompAddress
from meta.views import MetadataMixin
class SettingsView(TemplateView): class SettingsView(TemplateView):
@ -25,19 +32,14 @@ class SettingsView(TemplateView):
password, email notifications, social settings, subscription password, email notifications, social settings, subscription
""" """
template_name = 'accounts/settings.html' template_name = 'client/accounts/settings.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(SettingsView, self).get_context_data(**kwargs) context = super(SettingsView, self).get_context_data(**kwargs)
context['change_password_form'] = ChangePasswordForm() context['change_password_form'] = ChangePasswordForm()
context['email_announcement_form'] = EmailAnnouncementForm() context['email_announcement_form'] = EmailAnnouncementForm()
return context return context
def dates_range(date1, date2):
delta = date2 - date1
dates = []
for i in range(delta.days + 1):
dates.append(date1 + datetime.timedelta(days=i))
return dates
class CalendarView(TemplateView): class CalendarView(TemplateView):
""" """
@ -54,7 +56,6 @@ class CalendarView(TemplateView):
- events - events in current months - events - events in current months
- days - days in current month - days - days in current month
- current_day - current_day
""" """
context = super(CalendarView, self).get_context_data(**kwargs) context = super(CalendarView, self).get_context_data(**kwargs)
now = datetime.datetime.now().replace(microsecond=0, second=0, minute=0, hour=0) now = datetime.datetime.now().replace(microsecond=0, second=0, minute=0, hour=0)
@ -72,32 +73,27 @@ class CalendarView(TemplateView):
number_of_days = python_calendar.monthrange(now.year, now.month)[1] number_of_days = python_calendar.monthrange(now.year, now.month)[1]
# number of days in current month # number of days in current month
days = [datetime.datetime(now.year, now.month, i+1) for i in range(number_of_days)] days = [datetime.datetime(now.year, now.month, i+1) for i in range(number_of_days)]
#context['days'] = days
calendar = self.request.user.calendar calendar = self.request.user.calendar
# events in current month # events in current month
context['events'] = calendar.events_by_month(now) context['events'] = calendar.events_by_month(now)
else: else:
number_of_days = python_calendar.monthrange(year, month)[1] number_of_days = python_calendar.monthrange(year, month)[1]
# days in current month
days = [datetime.datetime(year, month, i+1) for i in range(number_of_days)] days = [datetime.datetime(year, month, i+1) for i in range(number_of_days)]
# number of days in current month
#context['days'] = days
calendar = self.request.user.calendar calendar = self.request.user.calendar
now = now.replace(year=year, month=month, day=1) now = now.replace(year=year, month=month, day=1)
# events in current month # events in current month
context['events'] = calendar.events_by_month(now) context['events'] = calendar.events_by_month(now)
# add days from previous monday to next sunday
# add days from previous mondey to next sunday
first_day = days[0] first_day = days[0]
if first_day.weekday() != 0: if first_day.weekday() != 0:
past_monday = first_day + rdelta.relativedelta(days=-1, weekday=rdelta.MO(-1)) past_monday = first_day + rdelta.relativedelta(days=-1, weekday=rdelta.MO(-1))
a = [past_monday + datetime.timedelta(days=x) for x in range((first_day - past_monday).days)] a = [past_monday + datetime.timedelta(days=x) for x in range((first_day - past_monday).days)]
days = a + days days = a + days
last_day = days[-1] last_day = days[-1]
if last_day != 6: if last_day != 6:
@ -106,9 +102,6 @@ class CalendarView(TemplateView):
days += b days += b
events = context['events'] events = context['events']
context['days'] = days context['days'] = days
#days = context['days']
event_in_day = False
counter = 0
dates_with_events = [] dates_with_events = []
for event in events: for event in events:
dates_with_events += dates_range(event.data_begin, event.data_end) dates_with_events += dates_range(event.data_begin, event.data_end)
@ -138,39 +131,6 @@ class CalendarView(TemplateView):
return context return context
class ProfileView(TemplateView):
"""
display template with user information forms
in template forms handles dynamically by ajax
"""
template_name = 'accounts/new_profile.html'
def get_context_data(self, **kwargs):
context = super(ProfileView, self).get_context_data(**kwargs)
user = self.request.user
profile = user.profile
profile_forms = {
'avatar_form': AvatarForm(instance=profile), 'name_form': NameForm(instance=user),
'home_form': HomeForm(instance=profile), 'work_form': WorkForm(instance=user),
'about_company_form': AboutCompanyForm(instance=profile), 'phone_form': PhoneForm(instance=profile),
'email_form': EmailForm(instance=user), 'web_page_form': WebPageForm(instance=profile),
'social_form': SocialForm(instance=profile), 'about_form': AboutForm(instance=profile)
}
if not user.company:
company_form = {'company_form': CreateCompanyForm()}
context.update(company_form)
context.update(profile_forms)
return context
from company.edit_forms import NameForm as CompNameForm, HomeForm as CompHomeForm, PhoneForm as CompPhoneForm,\
EmailForm as CompEmailForm, WebPageForm as CompWebPageForm, SocialForm as CompSocialForm,\
TagForm as CompTagForm, DescriptionForm as CompDescr, StaffForm as CompStaff, \
FoundationForm as CompFound, SpecializationForm as CompSpec, AddressForm as CompAddress
class ProfileCompanyView(TemplateView): class ProfileCompanyView(TemplateView):
""" """
display template with user company information forms display template with user company information forms
@ -205,10 +165,6 @@ class ProfileCompanyView(TemplateView):
return context return context
from meta.views import MetadataMixin
class UserView(MetadataMixin, TemplateView): class UserView(MetadataMixin, TemplateView):
""" """
display user information for another users display user information for another users
@ -243,8 +199,6 @@ class UserView(MetadataMixin, TemplateView):
context.update(profile_forms) context.update(profile_forms)
context['message_form'] = SendForm() context['message_form'] = SendForm()
context['member'] = user context['member'] = user
return context return context
@ -272,6 +226,7 @@ class BaseProfileView(ProfileInvalidView):
response = {'success': True, 'rating': profile.user.rating} response = {'success': True, 'rating': profile.user.rating}
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
class WorkView(ProfileInvalidView): class WorkView(ProfileInvalidView):
""" """
instance user instance user
@ -282,13 +237,11 @@ class WorkView(ProfileInvalidView):
user = self.request.user user = self.request.user
form = self.form_class(self.request.POST, instance=user) form = self.form_class(self.request.POST, instance=user)
user = form.save() user = form.save()
#company = user.company
#response = {'success': True, 'url':company.get_permanent_url()}
response = {'success': True, 'rating': user.rating} response = {'success': True, 'rating': user.rating}
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
class AvatarView(BaseProfileView): class AvatarView(BaseProfileView):
""" """
instance profile. save user avatar. instance profile. save user avatar.
@ -350,6 +303,7 @@ class AboutView(BaseProfileView):
""" """
form_class = AboutForm form_class = AboutForm
class NameView(ProfileInvalidView): class NameView(ProfileInvalidView):
""" """
instance user instance user
@ -364,25 +318,14 @@ class NameView(ProfileInvalidView):
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
from exposition.models import Exposition
def get_user(url):
try:
url = int(url)
user = get_object_or_404(User, id=url)
except ValueError:
user = get_object_or_404(User, url=url)
return user
class UserEventView(ListView): class UserEventView(ListView):
model = Exposition model = Exposition
template_name = 'accounts/user_events.html' template_name = 'client/accounts/user_events.html'
paginate_by = 10 paginate_by = 10
obj = None obj = None
event_type = None event_type = None
def get_queryset(self): def get_queryset(self):
url = self.kwargs.get('url') url = self.kwargs.get('url')
user = get_user(url) user = get_user(url)
@ -395,6 +338,7 @@ class UserEventView(ListView):
context['event_type'] = self.event_type context['event_type'] = self.event_type
return context return context
class UserExpositionsView(MetadataMixin, UserEventView): class UserExpositionsView(MetadataMixin, UserEventView):
""" """
return template with list of expos that user joined return template with list of expos that user joined
@ -422,17 +366,6 @@ class UserConferenceView(MetadataMixin, UserEventView):
self.kwargs['user_full_name'] = user.get_full_name() self.kwargs['user_full_name'] = user.get_full_name()
return user.get_confs() return user.get_confs()
class UserSeminarView(UserEventView):
"""
return template with list of seminars that user joined
"""
event_type = _(u'Семинары')
def get_queryset(self):
url = self.kwargs.get('url')
user = get_user(url)
self.obj = user
return user.get_seminars()
@login_required @login_required
def change_password(request): def change_password(request):
@ -462,10 +395,10 @@ def change_password(request):
else: else:
return HttpResponse(json.dumps(success), content_type='application/json') return HttpResponse(json.dumps(success), content_type='application/json')
from django.views.generic.edit import FormMixin
class Feed(ListView): class Feed(ListView):
template_name = 'client/accounts/feed.html' template_name = 'client/accounts/feed.html'
paginate_by = 10 paginate_by = settings.CLIENT_PAGINATION
model = Exposition model = Exposition
filter_form = FeedFilterForm filter_form = FeedFilterForm
success_url = '/profile/feed/' success_url = '/profile/feed/'
@ -477,11 +410,9 @@ class Feed(ListView):
form.filter_save() form.filter_save()
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)
def get_queryset(self): def get_queryset(self):
filter = self.request.user.eventfilter filter_obj = self.request.user.eventfilter
qs = filter.get_queryset() qs = filter_obj.get_queryset()
return qs return qs
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):

@ -1,97 +0,0 @@
from django.core.management.base import BaseCommand, CommandError
from company.models import Company
from theme.models import Theme, Tag
from accounts.models import User
from functions.form_check import translit_with_separator
import datetime
import MySQLdb
from MySQLdb.cursors import DictCursor
def convert_to_int(st):
if not st:
return None
deduct = ('-','(',')','.',' ')
for elem in deduct:
st = st.replace(elem, '')
if st.isdigit():
return int(st)
else:
return None
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="root",
passwd="qazedc",
db="expomap_ru",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = "select * from customers_company"
cursor.execute(sql)
res = cursor.fetchall()
for c in res:
phone = convert_to_int(c.get('phone'))
fax = convert_to_int(c.get('fax'))
url = c['url']
if not url:
url = translit_with_separator(c.get('title'))
company = Company(id=c['company_id'], url=url, phone=phone, fax=fax,
email=c.get('email'), web_page=c.get('website'), twitter=c.get('twitter', ''))
company.translate('ru')
company.name = c.get('title')
company.specialization = c.get('specialize')
company.description = c.get('about')
company.address_inf = c.get('adress')
user = User.objects.safe_get(id=user_id)
company.creator = user
print('not_saved: %s'%c['title'])
company.save()
user_id = c['customers_id']
print('saved: %s'%str(company))
if user:
user.company = company
if not user.last_login:
now = datetime.datetime.now()
user.last_login = now
user.save()
theme = None
theme_id = c.get('otrasly')
if theme_id:
try:
theme = Theme.objects.get(id=theme_id)
except Theme.DoesNotExist:
continue
company.theme.add(theme)
if not theme:
continue
tags = c.get('tags')
if tags:
tags = tags.split(',')
if tags:
for tag_id in tags:
try:
tag = Tag.objects.get(id=tag_id)
except Tag.DoesNotExist:
continue
if tag.theme == theme:
company.tag.add(tag)
else:
continue
#print(str(type(res[0]['phone'])))
print('success')

@ -1,77 +0,0 @@
from django.core.management.base import BaseCommand, CommandError
from company.models import Company
from theme.models import Theme, Tag
from accounts.models import User
from functions.form_check import translit_with_separator
import datetime
import MySQLdb
from MySQLdb.cursors import DictCursor
def convert_to_int(st):
if not st:
return None
deduct = ('-','(',')','.',' ')
for elem in deduct:
st = st.replace(elem, '')
if st.isdigit():
return int(st)
else:
return None
class Command(BaseCommand):
def handle(self, *args, **options):
db = MySQLdb.connect(host="localhost",
user="root",
passwd="qazedc",
db="expomap_ru",
charset='utf8',
cursorclass=DictCursor)
cursor = db.cursor()
sql = "select * from customers_company WHere otrasly>0"
cursor.execute(sql)
res = cursor.fetchall()
print(len(res))
for c in res:
id = c['company_id']
company = Company.objects.safe_get(id=id)
if not company:
continue
theme_id = c.get('otrasly')
tags = c.get('tags')
if theme_id:
try:
theme = Theme.objects.get(id=theme_id)
except Theme.DoesNotExist:
continue
print(theme)
print(company)
company.theme.add(theme)
print('add %s theme to %s company'%(str(theme), str(company)))
print('123')
if not theme:
continue
tags = c.get('tags')
if tags:
tags = tags.split(',')
if tags:
for tag_id in tags:
try:
tag = Tag.objects.get(id=tag_id)
except Tag.DoesNotExist:
continue
if tag.theme == theme:
company.tag.add(tag)
print('add %s tag to %s company'%(str(tag), str(company)))
else:
continue

@ -1,5 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import re import re
import datetime
from django.shortcuts import get_object_or_404
from accounts.models import User
def get_referer(request, default=None): def get_referer(request, default=None):
referer = request.META.get('HTTP_REFERER') referer = request.META.get('HTTP_REFERER')
@ -20,4 +23,19 @@ def split_params(st):
if n != -1: if n != -1:
params.append({'type': item[:n], 'url':item[n+1:]}) params.append({'type': item[:n], 'url':item[n+1:]})
return params return params
def dates_range(date1, date2):
delta = date2 - date1
dates = []
for i in range(delta.days + 1):
dates.append(date1 + datetime.timedelta(days=i))
return dates
def get_user(url):
try:
url = int(url)
user = get_object_or_404(User, id=url)
except ValueError:
user = get_object_or_404(User, url=url)
return user

@ -426,7 +426,7 @@ place_exp_sett = {
u'Выставочный зал': {u'field': u'exposition_hall', u'func': bool}, u'Выставочный зал': {u'field': u'exposition_hall', u'func': bool},
u'Площадь выст. зала': {u'field': u'exp_hall_area', u'func': to_int}, u'Площадь выст. зала': {u'field': u'exp_hall_area', u'func': to_int},
u'Общая вместимость': {u'field': u'total_capacity', u'func': to_int}, u'Общая вместимость': {u'field': u'total_capacity', u'func': to_int},
u'Количество залов': {u'field': u'amount_halls', u'func': bool}, u'Количество залов': {u'field': u'amount_halls', u'func': bool},
} }
# export # export
place_settings=[ place_settings=[

@ -8,7 +8,8 @@ from registration import signals
from registration.models import RegistrationProfile from registration.models import RegistrationProfile
from registration.views import ActivationView as BaseActivationView from registration.views import ActivationView as BaseActivationView
from registration.views import RegistrationView as BaseRegistrationView from registration.views import RegistrationView as BaseRegistrationView
from django.views.generic import View from accounts.forms import RegistrationCompleteForm, SocialRegistrationCompleteForm
from social.apps.django_app.default.models import UserSocialAuth
import json import json
@ -248,8 +249,7 @@ def LoginView(request):
else: else:
HttpResponseRedirect('/') HttpResponseRedirect('/')
from accounts.forms import RegistrationCompleteForm, RecoveryForm, SocialRegistrationCompleteForm
from social.apps.django_app.default.models import UserSocialAuth
def complete_registration(request): def complete_registration(request):
@ -290,22 +290,4 @@ def acquire_email(request, template_name="registration/acquire_email.html"):
def inactive_user_message(request): def inactive_user_message(request):
return render(request, 'registration/social_registration_complete.html') return render(request, 'registration/social_registration_complete.html')
def pswd_recovery(request):
#if request.is_ajax():
response = {'success': False}
form = RecoveryForm(request.POST)
if form.is_valid():
user = form.get_user()
user.se
response['success']=True
else:
response['errors'] = form.errors
return HttpResponse(json.dumps(response), content_type='application/json')
#else:
# return HttpResponse('not ajax')

@ -1,6 +1,7 @@
{% extends 'base_catalog.html' %} {% extends 'base_catalog.html' %}
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
{% block bread_scrumbs %} {% block bread_scrumbs %}
<div class="bread-crumbs"> <div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a> <a href="/">{% trans 'Главная страница' %}</a>
@ -15,10 +16,10 @@
{% block page_body %} {% block page_body %}
<div class="page-body clearfix events-feed-page"> <div class="page-body clearfix events-feed-page">
<div class="events-filter-wrap" id="events-filter-wrap"> <div class="events-filter-wrap" id="events-filter-wrap">
<a rel="nofollow" id="filter-show-button" class="button icon-eye " href="javascript:void(0);">Фильтрация ленты</a> <a rel="nofollow" id="filter-show-button" class="button icon-eye " href="javascript:void(0);">{% trans 'Фильтрация ленты' %}</a>
<div class="events-filter" id="events-filter"> <div class="events-filter" id="events-filter">
<section class="col"> <section class="col">
<h2><span id="filter-subject-label" data-default="Тематические фильтры не выбраны" data-selected="Тематика">Тематические фильтры не выбраны</span>: (<a class="change-filter filter-modal-open" href="#filter-pwSubj" id="filter-subj-modal-trigger">Изменить</a>):</h2> <h2><span id="filter-subject-label" data-default="{% trans 'Тематические фильтры не выбраны' %}" data-selected="{% trans 'Тематика' %}">{% trans 'Тематические фильтры не выбраны' %}</span>: (<a class="change-filter filter-modal-open" href="#filter-pwSubj" id="filter-subj-modal-trigger">{% trans 'Изменить' %}</a>):</h2>
<div class="events-filter-box c-select-box"> <div class="events-filter-box c-select-box">
<div class="csb-selected-items " > <div class="csb-selected-items " >
<div class="csb-selected csb-subj-selected dna-template" id="filter-subject-tags"> <div class="csb-selected csb-subj-selected dna-template" id="filter-subject-tags">
@ -30,7 +31,7 @@
</div> </div>
</section> </section>
<section class="col "> <section class="col ">
<h2 class="mt-0"><span id="filter-place-label" data-default="Географические фильтры не выбраны" data-selected="Место проведения">Географические фильтры не выбраны</span>: (<a class="change-filter filter-modal-open" href="#filter-pwPlace" id="filter-place-modal-trigger">Изменить</a>):</h2> <h2 class="mt-0"><span id="filter-place-label" data-default="{% trans 'Географические фильтры не выбраны' %}" data-selected="{% trans 'Место проведения' %}">{% trans 'Географические фильтры не выбраны' %}</span>: (<a class="change-filter filter-modal-open" href="#filter-pwPlace" id="filter-place-modal-trigger">{% trans 'Изменить' %}</a>):</h2>
<div class="events-filter-box c-select-box"> <div class="events-filter-box c-select-box">
<div class="csb-selected-items" > <div class="csb-selected-items" >
@ -51,11 +52,11 @@
<div class="search-modal-body"> <div class="search-modal-body">
{% if search_form.th %} {% if search_form.th %}
{% include 'client/popups/theme.html' with search_form=search_form filter="filter-" formId="filter-pwSubj" selectedItemTemplate="filter-subj-selected" autoCompleteId="filter-subj-complete-block" filterInputId="filter-subj-fliter-input" selectedItemsContainer="filter-csb-subj-selected-items" subjectTriggerWrapId="filter-subj-checks" exhibitionCheck="filter-exhibition-check" conferenceCheck="filter-conference-check" prefix="f-s-" submitText="Применить" %} {% include 'client/popups/theme.html' with search_form=search_form filter="filter-" formId="filter-pwSubj" selectedItemTemplate="filter-subj-selected" autoCompleteId="filter-subj-complete-block" filterInputId="filter-subj-fliter-input" selectedItemsContainer="filter-csb-subj-selected-items" subjectTriggerWrapId="filter-subj-checks" exhibitionCheck="filter-exhibition-check" conferenceCheck="filter-conference-check" prefix="f-s-" submitText="{% trans 'Применить' %}" %}
{% endif %} {% endif %}
{% if search_form.area %} {% if search_form.area %}
{% include 'client/popups/place.html' with search_form=search_form filter="filter-" formId="filter-pwPlace" selectedItemTemplate="filter-csb-selected" autoCompleteId="filter-place-complete-block" filterInputId="filter-place-filter-input" selectedItemsContainer="filter-csb-selected-items" prefix="f-p-" submitText="Применить" %} {% include 'client/popups/place.html' with search_form=search_form filter="filter-" formId="filter-pwPlace" selectedItemTemplate="filter-csb-selected" autoCompleteId="filter-place-complete-block" filterInputId="filter-place-filter-input" selectedItemsContainer="filter-csb-selected-items" prefix="f-p-" submitText="{% trans 'Применить' %}" %}
{% endif %} {% endif %}
</div> </div>

@ -1,481 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% load template_filters %}
{% block style %}
<link rel="stylesheet" href="{% static 'client/css/select2.css' %}">
<style>
.add_link_teg .tag-select{float: left;margin: 0 13px 0 0;min-height: 36px;}
</style>
{% endblock %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<a href="/profile/">{% trans 'Личный кабинет' %}</a>
<strong>{% trans 'Компания' %}</strong>
</div>
{% endblock %}
{% block page_title %}
{% endblock %}
{% block content_list %}
<div class="m-article">
<div class="item-wrap clearfix">
<aside>
<div class="i-pict">
<a class="add_pic_block" title="">
<span></span>
<i>{% trans 'Добавить лого' %}</i>
<b>+20</b>
</a>
</div>
<div class="i-rating" title="Рейтинг: 551">551</div>
</aside>
<div class="i-info">
<header>
<div class="{% if home_form.instance.country and home_form.instance.city %}i-place p-editable{% else %}i-place p-editable add_link_text add_link_text_medium{% endif %}">
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
<a href="#" id="static-home-country">{{ home_form.instance.country }}</a>
</span>
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
, <a href="#" id="static-home-city">{{ home_form.instance.city }}</a>
</span>
<div class="edit-wrap e-left">
{% if home_form.instance.country and home_form.instance.city %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Указать' %}</a>
<div class="add_link_text_text">{% trans 'свой город' %}<b>+5</b></div>
{% endif %}
<form class="clearfix update-profile-form" id="home_form" action="/company/update/home/" method="post">{% csrf_token %}
<div class="e-form">
<div class="ef-body">
<div class="epfl">
<label>Страна</label>
<div class="epf-field">
{{ home_form.country }}
</div>
</div>
<div class="epfl">
<label>{% trans 'Город' %}</label>
<div class="epf-field">
{{ home_form.city }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</form>
</div>
</div>
<div class="site_link">
<a href="{{ request.user.company.get_permanent_url }}" title="">
{{ request.user.company.get_permanent_url }}
</a>
</div>
<div class="i-title p-editable p-editable">
<span id="static-name-value">{{ name_form.name.value }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="name_form" action="/company/update/name/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ name_form.name.label }}</label>
<div class="epf-field">
{{ name_form.name }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</header>
<div class="{% if spec_form.specialization.value %}i-position p-editable{% else %}i-descr p-editable add_link_text add_link_text_top{% endif %}">
{% if spec_form.specialization.value %}
<span id="static-spec-value">{{ spec_form.specialization.value }}</span>
{% endif %}
<div class="edit-wrap">
{% if spec_form.specialization.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'краткое описание компании' %} <b>+20</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="spec_form" action="/company/update/specialization/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epf-field">
<label>{{ spec_form.specialization.label }}</label>
<div class="epf-field">
{{ spec_form.specialization }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="i-area" id="theme-inf" data-theme="{% for th in request.user.company.theme.all %}{{ th.id }},{% endfor %}">
{% for th in request.user.company.theme.all %}
<a href="/members/theme-{{ th.url }}">{{ th.name }}</a>{% ifnotequal forloop.counter request.user.company.theme.all|length %},{% endifnotequal %}
{% endfor %}
</div>
<hr />
<div class="{% if address_form.address_inf.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if address_form.address_inf.value %}
<span id="static-address-value">{{ address_form.address_inf.value }}</span>
{% endif %}
<div class="edit-wrap">
{% if address_form.address_inf.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'адрес компании' %} <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="address_form" action="/company/update/address/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epf-field">
<label>{{ address_form.address_inf.label }}</label>
{{ address_form.address_inf }}
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<hr />
<div class="add_link_teg">
<div class="tag-select">{{ tag_form.tag }}</div>
<b>+5</b>
</div>
<div class="clear"></div>
<hr />
<div class="i-contacts clearfix">
<div class="ic-buttons ic-buttons_pos dd_width_4">
<a class="button icon-edit icb-edit-profile" href="#">{% trans 'редактировать профиль' %}</a>
<a class="button orange icon-edit icb-exit-edit" href="#">{% trans 'завершить редактирование' %}</a>
<div class="ic-buttons_text">{% trans 'Добавить профили в соц.сетях' %}:</div>
<div class="p-editable add_link_text add_link_text_medium soc-media-indent">
<div class="edit-wrap">
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<ul class="soc-media-buttons soc-media-buttons1">
<li>
{% if social_form.facebook.value %}
<a href="{{ social_form.facebook.value }}" target="_blank">
<img id="img-facebook" src="{% static 'client/img/soc-medias/sm-icon-fb.png' %}" title="Facebook" alt="Facebook" />
</a>
{% else %}
<img id="img-facebook" src="{% static 'client/img/soc-medias/icon-fb_hover.png' %}" title="Facebook" alt="Facebook" />
{% endif %}
</li>
<li>
{% if social_form.linkedin.value %}
<a href="{{ social_form.linkedin.value }}" target="_blank">
<img id="img-linkedin" src="{% static 'client/img/soc-medias/sm-icon-lin.png' %}" title="LinkedIn" alt="LinkedIn" />
</a>
{% else %}
<img id="img-linkedin" src="{% static 'client/img/soc-medias/icon-lin_hover.png' %}" title="LinkedIn" alt="LinkedIn" />
{% endif %}
<li>
{% if social_form.vk.value %}
<a href="{{ social_form.vk.value }}" target="_blank">
<img id="img-vk" src="{% static 'client/img/soc-medias/sm-icon-vk.png' %}" title="В контакте" alt="В контакте" />
</a>
{% else %}
<img id="img-vk" src="{% static 'client/img/soc-medias/sm-icon-vk_hover.png' %}" title="В контакте" alt="В контакте" />
{% endif %}
</li>
<li>
{% if social_form.twitter.value %}
<a href="{{ social_form.twitter.value }}" target="_blank">
<img id="img-twitter" src="{% static 'client/img/soc-medias/sm-icon-twit.png' %}" title="Twitter" alt="Twitter" />
</a>
{% else %}
<img id="img-twitter" src="{% static 'client/img/soc-medias/sm-icon-twit_hover.png' %}" title="Twitter" alt="Twitter" />
{% endif %}
</li>
</ul>
<div class="add_link_text_text"><b>+5 {% trans 'за каждый' %}</b></div>
<div class="e-form">
<form class="clearfix update-profile-form" id="social_form" action="/company/update/social/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-fb-w.png' %}" title="Facebook" alt="Facebook" /> {{ social_form.facebook.label }}</label>
<div class="epf-field">
{{ social_form.facebook }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-lin-w.png' %}" title="LinkedIn" alt="LinkedIn" /> {{ social_form.linkedin.label }}</label>
<div class="epf-field">
{{ social_form.linkedin }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-vk-w.png' %}" title="В контакте" alt="В контакте" /> {{ social_form.vk.label }}</label>
<div class="epf-field">
{{ social_form.vk }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-twit-w.png' %}" title="Twitter" alt="Twitter" /> {{ social_form.twitter.label }}</label>
<div class="epf-field">
{{ social_form.twitter }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
<div class="ic-links ic-links_indent dd_width_5">
<div class="{% if phone_form.phone.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if phone_form.phone.value %}
<span id="static-phone-value">{{ phone_form.phone.value|phone }}</span>
{% endif %}
<div class="edit-wrap">
{% if phone_form.phone.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'номер телефона' %} <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="phone_form" action="/company/update/phone/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ phone_form.phone.label }}</label>
<div class="epf-field">
{{ phone_form.phone }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="{% if email_form.email.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if email_form.email.value %}
<div class="ic-mail add_indent ">
<a id="static-email-value" class="icon-mail" href="mailto:{{ email_form.email.value }}">{{ email_form.email.value }}</a>
</div>
{% endif %}
<div class="edit-wrap">
{% if email_form.email.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">email <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="email_form" action="/company/update/email/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ email_form.email.label }}</label>
<div class="epf-field">
{{ email_form.email }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="{% if web_page_form.web_page.value %}ic-site p-editable{% else %}ic-site p-editable add_link_text add_link_text_medium{% endif %}">
{% if web_page_form.web_page.value %}
<a id="static-web-page-value" class="icon-ext-link" href="{% if web_page_form.web_page.value %}{{ web_page_form.web_page.value }}{% else %}#{% endif %}" target="_blank">
{% if web_page_form.web_page.value %}
{{ web_page_form.web_page.value }}
{% endif %}
</a>
{% endif %}
<div class="edit-wrap">
{% if web_page_form.web_page.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans сайт' %} <b>+5</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="web_page_form" action="/company/update/web-page/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ web_page_form.web_page.label }}</label>
<div class="epf-field">
{{ web_page_form.web_page }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
</div>
<hr />
<div class="i-additional">
<div class="ia-title">{% trans 'Дополнительная информация' %}</div>
<div class="p-editable {% if found_form.foundation.value %}ic-tel ic-links {% else %}add_link_text add_link_text_medium{% endif %}">
<p id="static-found-value" style="{% if found_form.foundation.value == '' or found_form.foundation.value == None %}display:none;{% endif %}">{% trans 'Год основания' %}: <span>{{ found_form.foundation.value }}</span></p>
<div class="edit-wrap">
<a class="e-btn" href="#" >{% trans 'редактировать' %}</a>
<div id="static-foundation" style="{% if found_form.foundation.value %} display:none;{% endif %}">
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'год основания' %} <b>+15</b></div>
</div>
<div class="e-form">
<form class="clearfix update-profile-form" id="found_form" action="/company/update/foundation/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ found_form.foundation.label }}</label>
<div class="epf-field">
{{ found_form.foundation }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="p-editable {% if staff_form.staff_number.value %}ic-tel ic-links {% else %}add_link_text add_link_text_medium{% endif %}">
<p id="static-staff_number-value" style="{% if staff_form.staff_number.value == '' or staff_form.staff_number.value == None %}display:none;{% endif %}">{% trans 'к-во сотрудников' %}: <span id="static-staff-value">{{ staff_form.staff_number.value }}</span></p>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div id="static-staff_number" style="{% if staff_form.staff_number.value %} display:none;{% endif %}">
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'к-во сотрудников' %} <b>+15</b></div>
</div>
<div class="e-form">
<form class="clearfix update-profile-form" id="staff_form" action="/company/update/staff/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ staff_form.staff_number.label }}</label>
<div class="epf-field">
{{ staff_form.staff_number }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="p-editable {% if description_form.description.value %}ic-tel {% else %}add_link_text add_link_text_medium{% endif %}">
<span id="static-description-value" style="{% if description_form.description.value == '' or description_form.description.value == None %}display:none;{% endif %}">{{ description_form.description.value }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div id="static-description" style="{% if description_form.description.value %} display:none;{% endif %}">
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'подробное описание компании' %}<b>+15</b></div>
</div>
<div class="e-form">
<form class="clearfix update-profile-form" id="description_form" action="/company/update/description/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ description_form.description.label }}</label>
<div class="epf-field">
{{ description_form.description }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block pre_scripts %}
<script src="{% static 'client/js/plugins/select2.min.js' %}"></script>
<script src="{% static 'client/js/plugins/select2_locale_ru.js' %}"></script>
{% endblock %}
{% block scripts %}
<script src="{% static 'client/js/plugins/inputmask/jquery.inputmask.js' %}"></script>
<script src="{% static 'client/js/plugins/inputmask/jquery.bind-first-0.2.3.min.js' %}"></script>
<script src="{% static 'client/js/plugins/inputmask/jquery.inputmask-multi.js' %}"></script>
{% if request.GET.debug == '1' %}
<script src="{% static 'client/js/_modules/page.company.js' %}"></script>
{% else %}
<script src="{% static 'client/js_min/_modules/page.company.min.js' %}"></script>
{% endif %}<script>
EXPO.company.init({
updateFormClass:'update-profile-form',
selectBox:[
{id:'id_country'},
{id:'id_city',
placeHolder:"{% trans 'Поиск города' %}",
path:'http://{{ request.get_host }}/city/get-city/'
},
{id:'id_tag',
placeholder:"{% trans 'Выберите ключевые теги' %}",
path:'http://{{ request.get_host }}/theme/get-tag/'
}
],
phoneBox: 'id_phone',
lang:{
workIn:"{% trans 'в' %}"
}
});
</script>
{% endblock %}

@ -61,7 +61,7 @@
{% block popup %} {% block popup %}
<div id="pw-reply" class="popup-window pw-reply"> <div id="pw-reply" class="popup-window pw-reply">
<header class="clearfix"> <header class="clearfix">
<div class="pw-title">Ответить</div> <div class="pw-title">{% trans 'Ответить' %}</div>
</header> </header>
<div class="pw-body clearfix"> <div class="pw-body clearfix">
<form class="pw-form" action="#" method="post" id="reply_form"> {% csrf_token %} <form class="pw-form" action="#" method="post" id="reply_form"> {% csrf_token %}

@ -1,436 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% load template_filters %}
{% load thumbnail %}
{% block style %}
<link rel="stylesheet" href="{% static 'client/css/select2.css' %}">
{% if not company_form %}
<style>
.add_company a:before { content:'';background: none; display: inline-block !important;}
.add_company a:hover:before {background: none !important;}
</style>
{% endif %}
{% endblock %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<strong>{% trans 'Личный кабинет' %}</strong>
</div>
{% endblock %}
{% block page_title %}
{% endblock %}
{% block content_list %}
<div class="m-article">
<div class="item-wrap clearfix">
<aside>
<div class="i-pict p-editable">
<form class="clearfix update-profile-form" enctype="multipart/form-data" id="avatar_form" action="/profile/update/avatar/" method="post">{% csrf_token %}
{% if request.user.profile.avatar %}
<a class="pic_block" style="padding-top: 0;" title="" id="pick-block">
{% thumbnail request.user.profile.avatar "100x100" crop="center" as im %}
<img clas="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
{% else %}
<a class="add_pic_block" title="" id="pick-block">
<p class="add-wrapper">
<span></span>
<i>Добавить фото</i>
<b>+20</b>
</p>
{% endif %}
{{ avatar_form.avatar }}
</a>
<span class="pic-edit-photo-wrap"><a href="javascript:void(0);" id="pic-edit-photo" class="pic-edit-photo" {% if not request.user.profile.avatar %}style="display:none;"{% endif %}>Изменить фото</a></span>
</form>
</div>
<div class="i-rating" title="Рейтинг: 551">551</div>
<div class="reason_block">
{% blocktrans %}
<p>Заполните свой<br>профиль, чтобы<br>повысить рейтинг</p>
<p>Чем выше<br>рейтинг —<br>тем больше<br>преимуществ!</p>
{% endblocktrans %}
</div>
</aside>
<div class="i-info">
<header>
<div class="{% if home_form.instance.country and home_form.instance.city %}i-place p-editable{% else %}i-place p-editable add_link_text add_link_text_medium{% endif %}">
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
<a href="#" id="static-home-country">{{ home_form.instance.country }}</a>
</span>
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
, <a href="#" id="static-home-city">{{ home_form.instance.city }}</a>
</span>
<div class="edit-wrap e-left">
{% if home_form.instance.country and home_form.instance.city %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">Указать</a>
<div class="add_link_text_text">свой город <b>+5</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="home_form" action="/profile/update/home/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{% trans 'Страна' %}</label>
<div class="epf-field">
{{ home_form.country }}
</div>
</div>
<div class="epfl">
<label>{% trans 'Город' %}</label>
<div class="epf-field">
{{ home_form.city }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="site_link">
<a href="{{ request.user.get_permanent_url }}" title="">
{{ request.user.get_permanent_url }}
</a>
</div>
<div class="i-title p-editable p-editable">
<span id="static-name-value">
{{ name_form.get_full_name }}
</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="name_form" action="/profile/update/name/"
method="post" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ name_form.first_name.label }}</label>
<div class="epf-field">
{{ name_form.first_name }}
</div>
</div>
<div class="epfl">
<label>{{ name_form.last_name.label }}</label>
<div class="epf-field">
{{ name_form.last_name }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</header>
{# position #}
<div class="{% if work_form.position.value and work_form.company.value %}p-editable{% else %}i-descr p-editable add_link_text add_link_text_top{% endif %}">
{% if work_form.position.value and work_form.company.value %}
<p id="static-work-value">
{{ work_form.position.value }}
{% if work_form.company.value %}
{% trans 'в' %} <a href="{{ request.user.company.get_permanent_url }}">"{{ request.user.company.name }}"</a>
{% endif %}
</p>
{% endif %}
<div class="edit-wrap">
{% if work_form.position.value and work_form.company.value %}
<a class="e-btn" href="/profile/company/">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Указать' %}</a>
<div class="add_link_text_text">{% trans 'свою должность и место работы' %} <b>+10</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="work_form" action="/profile/update/work/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ work_form.position.label }}</label>
<div class="epf-field">
{{ work_form.position }}
</div>
</div>
<div class="epfl">
<label>{{ work_form.company.label }}</label>
<div class="epf-field">
{{ work_form.company }}
</div>
</div>
<div class="add_company"><a id="add-comp-btn" class="pw-open" href="{% if not company_form %}/profile/company/{% else %}#pw-company{% endif %}" title="">{% if not company_form %}Изменить{% else %}Добавить{% endif %} компанию</a></div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
<div class="clear"></div>
</div>
<hr />
<div class="i-contacts clearfix">
<div class="ic-buttons ic-buttons_pos dd_width_4">
<a class="button icon-edit icb-edit-profile" href="#">{% trans 'редактировать профиль' %}</a>
<a class="button orange icon-edit icb-exit-edit" href="#">{% trans 'завершить редактирование' %}</a>
<div class="ic-buttons_text">Добавить профили в соц.сетях:</div>
<div class="p-editable add_link_text add_link_text_medium soc-media-indent">
<div class="edit-wrap">
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<ul class="soc-media-buttons soc-media-buttons1">
<li>
{% if social_form.facebook.value %}
<a href="{{ social_form.facebook.value }}" target="_blank">
<img id="img-facebook" src="{% static 'client/img/soc-medias/sm-icon-fb.png' %}" title="Facebook" alt="Facebook" />
</a>
{% else %}
<img id="img-facebook" src="{% static 'client/img/soc-medias/sm-icon-fb_hover.png' %}" title="Facebook" alt="Facebook" />
{% endif %}
</li>
<li>
{% if social_form.linkedin.value %}
<a href="{{ social_form.linkedin.value }}" target="_blank">
<img id="img-linkedin" src="{% static 'client/img/soc-medias/sm-icon-lin.png' %}" title="LinkedIn" alt="LinkedIn" />
</a>
{% else %}
<img id="img-linkedin" src="{% static 'client/img/soc-medias/sm-icon-lin_hover.png' %}" title="LinkedIn" alt="LinkedIn" />
{% endif %}
<li>
{% if social_form.vk.value %}
<a href="{{ social_form.vk.value }}" target="_blank">
<img id="img-vk" src="{% static 'client/img/soc-medias/sm-icon-vk.png' %}" title="В контакте" alt="В контакте" />
</a>
{% else %}
<img id="img-vk" src="{% static 'client/img/soc-medias/sm-icon-vk_hover.png' %}" title="В контакте" alt="В контакте" />
{% endif %}
</li>
<li>
{% if social_form.twitter.value %}
<a href="{{ social_form.twitter.value }}" target="_blank">
<img id="img-twitter" src="{% static 'client/img/soc-medias/sm-icon-twit.png' %}" title="Twitter" alt="Twitter" />
</a>
{% else %}
<img id="img-twitter" src="{% static 'client/img/soc-medias/sm-icon-twit_hover.png' %}" title="Twitter" alt="Twitter" />
{% endif %}
</li></li>
</ul>
<div class="add_link_text_text"><b>+5 {% trans 'за каждый' %}</b></div>
<div class="e-form">
<form class="clearfix update-profile-form" id="social_form" action="/profile/update/social/">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-fb-w.png' %}" title="Facebook" alt="Facebook" /> {{ social_form.facebook.label }}</label>
<div class="epf-field">
{{ social_form.facebook }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-lin-w.png' %}" title="LinkedIn" alt="LinkedIn" /> {{ social_form.linkedin.label }}</label>
<div class="epf-field">
{{ social_form.linkedin }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-vk-w.png' %}" title="В контакте" alt="В контакте" /> {{ social_form.vk.label }}</label>
<div class="epf-field">
{{ social_form.vk }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-twit-w.png' %}" title="Twitter" alt="Twitter" /> {{ social_form.twitter.label }}</label>
<div class="epf-field">
{{ social_form.twitter }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
<div class="ic-links ic-links_indent dd_width_5">
<div class="{% if phone_form.phone.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if phone_form.phone.value %}
<span id="static-phone-value">{{ phone_form.phone.value|phone }}</span>
{% endif %}
<div class="edit-wrap">
{% if phone_form.phone.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'номер телефона' %} <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="phone_form" action="/profile/update/phone/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ phone_form.phone.label }}</label>
<div class="epf-field">
{{ phone_form.phone }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="ic-mail add_indent">
<a class="icon-mail" href="mailto:{{ request.user.email }}">{{ request.user.email }}</a>
</div>
<div class="{% if web_page_form.web_page.value %}ic-site p-editable{% else %}ic-site p-editable add_link_text add_link_text_medium{% endif %}">
{% if web_page_form.web_page.value %}
<a class="icon-ext-link" id="static-web-page-value" href="{% if web_page_form.web_page.value %}{{ web_page_form.web_page.value }}{% else %}#{% endif %}" target="_blank">
{% if web_page_form.web_page.value %}
{{ web_page_form.web_page.value }}
{% endif %}
</a>
{% endif %}
<div class="edit-wrap">
{% if web_page_form.web_page.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'сайт' %} <b>+5</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="web_page_form" action="/profile/update/web-page/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ web_page_form.web_page.label }}</label>
<div class="epf-field">
{{ web_page_form.web_page }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
</div>
<hr />
<div class="{% if about_form.about.value %}i-additional{% else %}i-additional i-additional1{% endif %}">
{% if about_form.about.value %}
<div class="ia-title">{% trans 'О себе:' %}</div>
{% endif %}
<div class="{% if about_form.about.value %}p-editable{% else %}p-editable add_link_text{% endif %}">
{% if about_form.about.value %}
<p id="static-about-value">{{ about_form.about.value }}</p>
{% endif %}
<div class="edit-wrap">
{% if about_form.about.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'информацию о себе' %} <b>+10</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="about_form" action="/profile/update/about/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ about_form.about.label }}</label>
<div class="epf-field">
{{ about_form.about }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
</div>
</div>
{% block scripts %}
<script src="{% static 'client/js/plugins/inputmask/jquery.inputmask.js' %}"></script>
<script src="{% static 'client/js/plugins/inputmask/jquery.bind-first-0.2.3.min.js' %}"></script>
<script src="{% static 'client/js/plugins/inputmask/jquery.inputmask-multi.js' %}"></script>
{% if request.GET.debug == '1' %}
<script src="{% static 'client/js/_modules/page.profile.js' %}"></script>
{% else %}
<script src="{% static 'client/js_min/_modules/page.profile.min.js' %}"></script>
{% endif %}
<script>
EXPO.profile.init({
updateFormClass:'update-profile-form',
selectBox:[
{id:'id_country'},
{id:'id_theme',
placeHolder:"{% trans 'Выберите тематику компании' %}"
},
{id:'id_city',
placeholder:"{% trans 'Искать город' %}",
path:'http://{{ request.get_host }}/city/get-city/'
},
{id:'id_company',
placeholder:"{% trans 'Искать компанию' %}",
path:'http://{{ request.get_host }}/company/get-company/'
}
],
phoneBox: 'id_phone',
lang:{
workIn:"{% trans 'в' %}"
}
});
</script>
{% endblock %}
</div>
{% endblock %}
{% block popup %}
{% if company_form %}
{% include 'popups/create_company.html' with form=company_form %}
{% endif %}
{% endblock %}
{% block pre_scripts %}
<script src="{% static 'client/js/plugins/select2.min.js' %}"></script>
<script src="{% static 'client/js/plugins/select2_locale_ru.js' %}"></script>
{% endblock %}

@ -1,366 +0,0 @@
{% extends 'base_catalog.html' %}
{% load static %}
{% load i18n %}
{% load template_filters %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<strong>{% trans 'Личный кабинет' %}</strong>
</div>
{% endblock %}
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Личный кабинет' %}</h1>
</div>
{% endblock %}
{% block content_list %}
<div class="m-article">
<div class="item-wrap clearfix">
{# avatar #}
<aside>
<div class="i-pict p-editable">
{% if request.user.profile.avatar %}
<img src="{{ request.user.profile.avatar.url }}" alt="" />
{% endif %}
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" enctype="multipart/form-data" id="avatar_form"action="/profile/update/avatar/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ avatar_form.avatar.label }}</label>
<div class="epf-field">
<div class="input-file clearfix">
<div class="button icon-clip">{% trans 'выберите файл' %}</div>
<div class="file-text placehlder">{% trans 'Файл не выбран' %}</div>
<div class="if-field-wrap"><input id="id_avatar" type="file" name="avatar" /></div>
</div>
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</aside>
{# END avatar #}
<div class="i-info">
<header>
{# country and city #}
<div class="i-place p-editable">
{% if home_form.instance.country %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
<a href="#">{{ home_form.instance.country }}</a>
</span>
{% if home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
, <a href="#">{{ home_form.instance.city }}</a>
</span>
<div class="edit-wrap e-left">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="home_form" action="/profile/update/home/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ home_form.country.label }}</label>
<div class="epf-field">
{{ home_form.country }}
</div>
</div>
<div class="epfl">
<label>{% trans 'Город' %}</label>
<div class="epf-field">
<select name="city" style="width: 200px;">
</select>
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
{# END country and city #}
{# name #}
<div class="i-title p-editable">
<span>{{ name_form.get_full_name }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="name_form" action="/profile/update/name/"
method="post" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ name_form.first_name.label }}</label>
<div class="epf-field">
{{ name_form.first_name }}
</div>
</div>
<div class="epfl">
<label>{{ name_form.last_name.label }}</label>
<div class="epf-field">
{{ name_form.last_name }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
{# END name #}
</header>
{# position #}
<div class="i-position p-editable">
<p>
{{ work_form.position.value }}
{% if work_form.work.value %}
{% trans 'в' %} {{ work_form.work.value }}
{% endif %}
</p>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="work_form" action="/profile/update/work/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ work_form.position.label }}</label>
<div class="epf-field">
{{ work_form.position }}
</div>
</div>
<div class="epfl">
<label>{{ work_form.work.label }}</label>
<div class="epf-field">
{{ work_form.work }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
{# END position #}
{# description #}
<div class="i-descr p-editable">
<p>{{ about_company_form.about_company.value }}</p>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="about_company_form" action="/profile/update/about-company/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ about_company_form.about_company.label }}</label>
<div class="epf-field">
{{ about_company_form.about_company }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
{# END description #}
<hr />
<div class="i-contacts clearfix">
<div class="ic-buttons">
<a class="button icon-edit icb-edit-profile" href="#">{% trans 'редактировать профиль' %}</a>
<a class="button orange icon-edit icb-exit-edit" href="#">{% trans 'завершить редактирование' %}</a>
<div class="p-editable">
<ul class="soc-media-buttons">
<li><a href="{% if social_form.facebook.value %} {{ social_form.facebook.value }} {%else %}#{% endif %}">
<img src="{% static 'client/img/soc-medias/sm-icon-fb.png' %}" title="Facebook" alt="Facebook" />
</a>
</li>
<li><a href="{% if social_form.linkedin.value %} {{ social_form.linkedin.value }} {%else %}#{% endif %}">
<img src="{% static 'client/img/soc-medias/sm-icon-lin.png' %}" title="LinkedIn" alt="LinkedIn" />
</a>
</li>
<li><a href="{% if social_form.vk.value %} {{ social_form.vk.value }} {%else %}#{% endif %}">
<img src="{% static 'client/img/soc-medias/sm-icon-vk.png' %}" title="В контакте" alt="В контакте" />
</a>
</li>
<li><a href="{% if social_form.twitter.value %} {{ social_form.twitter.value }} {%else %}#{% endif %}">
<img src="{% static 'client/img/soc-medias/sm-icon-twit.png' %}" title="Twitter" alt="Twitter" />
</a>
</li>
</ul>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="social_form" action="/profile/update/social/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-fb-w.png' %}" title="Facebook" alt="Facebook" /> {{ social_form.facebook.label }}</label>
<div class="epf-field">
{{ social_form.facebook }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-lin-w.png' %}" title="LinkedIn" alt="LinkedIn" /> {{ social_form.linkedin.label }}</label>
<div class="epf-field">
{{ social_form.linkedin }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-vk-w.png' %}" title="В контакте" alt="В контакте" /> {{ social_form.vk.label }}</label>
<div class="epf-field">
{{ social_form.vk }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-twit-w.png' %}" title="Twitter" alt="Twitter" /> {{ social_form.twitter.label }}</label>
<div class="epf-field">
{{ social_form.twitter }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
{# contacts #}
<div class="ic-links">
<div class="ic-tel p-editable">
{% if phone_form.phone.value %}
<span>{{ phone_form.phone.value|phone }}</span>
{% endif %}
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="phone_form" action="/profile/update/phone/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ phone_form.phone.label }}</label>
<div class="epf-field">
{{ phone_form.phone }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
<div class="ic-site p-editable">
{% if web_page_form.web_page.value %}
<a class="icon-ext-link" href="{% if web_page_form.web_page.value %}{{ web_page_form.web_page.value }}{% else %}#{% endif %}" target="_blank">
{% if web_page_form.web_page.value %}
{{ web_page_form.web_page.value }}
{% endif %}
</a>
{% endif %}
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="web_page_form" action="/profile/update/web-page/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ web_page_form.web_page.label }}</label>
<div class="epf-field">
{{ web_page_form.web_page }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
{# END contacts #}
</div>
</div>
<hr/>
{# about #}
<div class="i-additional">
<div class="ia-title">{% trans 'О себе:' %}</div>
<div class="p-editable">
<p>{{ about_form.about.value }}</p>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="about_form" action="/profile/update/about/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ about_form.about.label }}</label>
<div class="epf-field">
{{ about_form.about }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
{# END about #}
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
{% if request.GET.debug == '1' %}
<script src="{% static 'client/js/_modules/page.profile.js' %}"></script>
{% else %}
<script src="{% static 'client/js_min/_modules/page.profile.min.js' %}"></script>
{% endif %}
<script>
EXPO.profile.init({
updateFormClass:'update-profile-form',
selectBox:[
{id:'id_country'},
{id:'id_theme',
placeHolder:'Выберите тематику компании'
},
{id:'id_city',
placeholder:'Search city',
path:'/city/get-city/'
},
{id:'id_company',
placeholder:'Search company',
path:'/company/get-company/'
}
]
});
</script>
{% endblock %}
Loading…
Cancel
Save