commit
a26c8e604f
28 changed files with 2483 additions and 5540 deletions
@ -0,0 +1,35 @@ |
||||
# Generated by Django 2.0.2 on 2018-02-05 15:59 |
||||
|
||||
from django.db import migrations |
||||
from django.contrib.contenttypes.models import ContentType |
||||
|
||||
|
||||
def fwrd_func(apps, schema_editor): |
||||
CourseComment = apps.get_model('course', 'CourseComment') |
||||
LessonComment = apps.get_model('course', 'LessonComment') |
||||
db_alias = schema_editor.connection.alias |
||||
if CourseComment.objects.exists(): |
||||
coursecomment_content_type = ContentType.objects.get( |
||||
app_label='course', model='coursecomment', |
||||
) |
||||
CourseComment.objects.using(db_alias).all().update( |
||||
polymorphic_ctype=coursecomment_content_type, |
||||
) |
||||
if LessonComment.objects.exists(): |
||||
lessoncomment_content_type = ContentType.objects.get( |
||||
app_label='course', model='lessoncomment', |
||||
) |
||||
LessonComment.objects.using(db_alias).all().update( |
||||
polymorphic_ctype=lessoncomment_content_type, |
||||
) |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('course', '0020_auto_20180202_1716'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RunPython(fwrd_func) |
||||
] |
||||
@ -0,0 +1,35 @@ |
||||
# Generated by Django 2.0.2 on 2018-02-05 16:15 |
||||
|
||||
from django.db import migrations |
||||
from django.contrib.contenttypes.models import ContentType |
||||
|
||||
|
||||
def fwrd_func(apps, schema_editor): |
||||
CourseComment = apps.get_model('course', 'CourseComment') |
||||
LessonComment = apps.get_model('course', 'LessonComment') |
||||
db_alias = schema_editor.connection.alias |
||||
if CourseComment.objects.using(db_alias).all().exists(): |
||||
coursecomment_content_type = ContentType.objects.get( |
||||
app_label='course', model='coursecomment', |
||||
) |
||||
CourseComment.objects.using(db_alias).all().update( |
||||
polymorphic_ctype=coursecomment_content_type, |
||||
) |
||||
if LessonComment.objects.using(db_alias).all().exists(): |
||||
lessoncomment_content_type = ContentType.objects.get( |
||||
app_label='course', model='lessoncomment', |
||||
) |
||||
LessonComment.objects.using(db_alias).all().update( |
||||
polymorphic_ctype=lessoncomment_content_type, |
||||
) |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('course', '0021_auto_20180205_1559'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RunPython(fwrd_func) |
||||
] |
||||
@ -0,0 +1,49 @@ |
||||
from django import forms |
||||
from django.contrib.auth import get_user_model |
||||
|
||||
User = get_user_model() |
||||
|
||||
|
||||
class UserEditForm(forms.ModelForm): |
||||
# first_name = forms.CharField() |
||||
# last_name = forms.CharField() |
||||
# email = forms.CharField() |
||||
# city = forms.CharField() |
||||
# country = forms.CharField() |
||||
birthday = forms.DateField(input_formats=['%d.%m.%Y']) |
||||
# gender = forms.ChoiceField(choices=User.GENDER_CHOICES, required=False) |
||||
gender = forms.CharField(required=False) |
||||
# about = forms.CharField() |
||||
old_password = forms.CharField(required=False) |
||||
new_password1 = forms.CharField(required=False) |
||||
new_password2 = forms.CharField(required=False) |
||||
instagram = forms.URLField(required=False) |
||||
facebook = forms.URLField(required=False) |
||||
twitter = forms.URLField(required=False) |
||||
pinterest = forms.URLField(required=False) |
||||
youtube = forms.URLField(required=False) |
||||
vkontakte = forms.URLField(required=False) |
||||
photo = forms.ImageField(required=False) |
||||
|
||||
class Meta: |
||||
model = User |
||||
fields = ( |
||||
'first_name', |
||||
'last_name', |
||||
'email', |
||||
'city', |
||||
'country', |
||||
'birthday', |
||||
'gender', |
||||
'about', |
||||
'old_password', |
||||
'new_password1', |
||||
'new_password2', |
||||
'instagram', |
||||
'facebook', |
||||
'twitter', |
||||
'pinterest', |
||||
'youtube', |
||||
'vkontakte', |
||||
'photo', |
||||
) |
||||
@ -0,0 +1,18 @@ |
||||
# Generated by Django 2.0.2 on 2018-02-06 13:22 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('user', '0004_auto_20180129_1259'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AddField( |
||||
model_name='user', |
||||
name='birthday', |
||||
field=models.DateField(blank=True, null=True, verbose_name='День рождения'), |
||||
), |
||||
] |
||||
@ -0,0 +1,18 @@ |
||||
# Generated by Django 2.0.2 on 2018-02-06 13:52 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('user', '0005_user_birthday'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AlterField( |
||||
model_name='user', |
||||
name='about', |
||||
field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='О себе'), |
||||
), |
||||
] |
||||
@ -0,0 +1,23 @@ |
||||
# Generated by Django 2.0.2 on 2018-02-07 08:08 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('user', '0006_auto_20180206_1352'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AlterField( |
||||
model_name='user', |
||||
name='city', |
||||
field=models.CharField(blank=True, max_length=85, null=True, verbose_name='Город'), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='user', |
||||
name='country', |
||||
field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Страна'), |
||||
), |
||||
] |
||||
@ -0,0 +1,209 @@ |
||||
{% extends "templates/lilcity/index.html" %} {% load static %} {% block content %} |
||||
<div class="section section_gray section_menu"> |
||||
<div class="section__center center center_xs"> |
||||
<div class="menu"> |
||||
<a class="menu__link active" href="{% url 'user-edit' user.id %}">Профиль</a> |
||||
<a class="menu__link" href="#">Уведомления</a> |
||||
<a class="menu__link" href="#">Платежи</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% comment %} |
||||
<!-- <div class="section section_confirm"> |
||||
<div class="section__center center center_xs"> |
||||
<div class="confirm"> |
||||
<div class="confirm__title title">Подтверждение почты</div> |
||||
<div class="confirm__content">На электронный адрес |
||||
<strong>sasha@lil.city</strong> отправлено письмо с кодом подтверждения. Введите код, чтобы подтвердить почту.</div> |
||||
<div class="confirm__form"> |
||||
<div class="confirm__field field field_code"> |
||||
<div class="field__wrap"> |
||||
<input class="field__input" type="text" placeholder="Введите код подтверждения"> |
||||
</div> |
||||
</div> |
||||
<button class="confirm__btn btn btn_dark">ПОДТВЕРДИТЬ</button> |
||||
</div> |
||||
<div class="confirm__content">Если у вас нет кода или письмо где-то затерялось, вы можете получить новый код подтверждения. Отправить новый код?</div> |
||||
</div> |
||||
</div> |
||||
</div> --> |
||||
{% endcomment %} |
||||
{% if messages %} |
||||
<div class="section section_gray section_menu"> |
||||
<div class="section__center center center_xs"> |
||||
{% for message in messages %} |
||||
<div class="message message_{{ message.tags }}">{{ message }}</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{{form.errors}} |
||||
<div class="section section_gray"> |
||||
<div class="section__center center center_xs"> |
||||
<div class="form"> |
||||
<form action="" method="POST" enctype="multipart/form-data"> |
||||
{% csrf_token %} |
||||
<div class="form__group"> |
||||
<div class="form__title">Личные данные</div> |
||||
<div class="form__ava ava"> |
||||
{% if user.photo %} |
||||
<img id="photo" class="ava__pic" src="{{user.photo.url}}"> |
||||
{% else %} |
||||
<img id="photo" class="ava__pic" src="{% static 'img/user.jpg' %}"> |
||||
{% endif %} |
||||
<input name="photo" class="ava__input" type="file" accept='image/*' onchange='openFile(event)'> |
||||
<div class="ava__icon"> |
||||
<svg class="icon icon-photo"> |
||||
<use xlink:href="{% static 'img/sprite.svg' %}#icon-photo"></use> |
||||
</svg> |
||||
</div> |
||||
</div> |
||||
<div class="form__fieldset"> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ИМЯ</div> |
||||
<div class="field__wrap"> |
||||
<input name='first_name' class="field__input" type="text" placeholder="Имя" value="{{ user.first_name }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ФАМИЛИЯ</div> |
||||
<div class="field__wrap"> |
||||
<input name='last_name' class="field__input" type="text" placeholder="Фамилия" value="{{ user.last_name }}"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">Почта</div> |
||||
<div class="field__wrap"> |
||||
<input name='email' class="field__input" type="email" placeholder="Почта" value="{{ user.email }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__fieldset"> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ГОРОД</div> |
||||
<div class="field__wrap"> |
||||
<input name='city' class="field__input" type="text" placeholder="Город" value="{% if user.city %}{{ user.city }}{% endif %}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">СТРАНА</div> |
||||
<div class="field__wrap"> |
||||
<input name='country' class="field__input" type="text" placeholder="Страна" value="{% if user.country %}{{ user.country }}{% endif %}"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="form__fieldset"> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ДАТА РОЖДЕНИЯ</div> |
||||
<div class="field__wrap"> |
||||
<input name='birthday' class="field__input" type="text" placeholder="dd.mm.yyyy" value="{% if user.birthday %}{{ user.birthday | date:'d.m.Y' }}{% endif %}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ПОЛ</div> |
||||
<div class="field__wrap"> |
||||
<div class="field__select select js-select{% if user.gender and user.gender != 'n' %} selected{% endif %}"> |
||||
<div class="select__head js-select-head"> |
||||
{% if user.gender == 'f' %}Ж{% elif user.gender == 'm' %}M{% else %}М / Ж{% endif %} |
||||
</div> |
||||
<div class="select__drop js-select-drop"> |
||||
<div class="select__option js-select-option" data-gender-option data-gender="m"> |
||||
<div class="select__title">М</div> |
||||
</div> |
||||
<div class="select__option js-select-option" data-gender-option data-gender="f"> |
||||
<div class="select__title">Ж</div> |
||||
</div> |
||||
</div> |
||||
<input id="gender" name='gender' class="select__input" type="hidden"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">О себе</div> |
||||
<div class="field__wrap"> |
||||
<textarea name='about' class="field__textarea" placeholder="Расскажите о себе и своем опыте">{% if user.about %}{{ user.about }}{% endif %}</textarea> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="form__group"> |
||||
<div class="form__title">Пароль</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ТЕКУЩИЙ ПАРОЛЬ</div> |
||||
<div class="field__wrap"> |
||||
<input name='old_password' class="field__input" type="password" placeholder="Введите текущий пароль"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">НОВЫЙ ПАРОЛЬ</div> |
||||
<div class="field__wrap"> |
||||
<input name='new_password1' class="field__input" type="password" placeholder="Введите новый пароль"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">ПОДТВЕРДИТЬ НОВЫЙ ПАРОЛЬ</div> |
||||
<div class="field__wrap"> |
||||
<input name='new_password2' class="field__input" type="password" placeholder="Подтвердите новый пароль"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="form__group"> |
||||
<div class="form__title">Соцсети</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">INSTAGRAM</div> |
||||
<div class="field__wrap"> |
||||
<input name='instagram' class="field__input" type="text" placeholder="https://instagram.com/school.lil.city" value="{{ user.instagram }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">FACEBOOK</div> |
||||
<div class="field__wrap"> |
||||
<input name='facebook' class="field__input" type="text" placeholder="https://facebook.com/lilcitycompany" value="{{ user.facebook }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">TWITTER</div> |
||||
<div class="field__wrap"> |
||||
<input name='twitter' class="field__input" type="text" placeholder="https://twitter.com/lilcitycompany" value="{{ user.twitter }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">PINTEREST</div> |
||||
<div class="field__wrap"> |
||||
<input name='pinterest' class="field__input" type="text" placeholder="https://pinterest.com/lilcitycompany" value="{{ user.pinterest }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">YOUTUBE</div> |
||||
<div class="field__wrap"> |
||||
<input name='youtube' class="field__input" type="text" placeholder="https://youtube.com/lilcitycompany" value="{{ user.youtube }}"> |
||||
</div> |
||||
</div> |
||||
<div class="form__field field"> |
||||
<div class="field__label">VKONTAKTE</div> |
||||
<div class="field__wrap"> |
||||
<input name='vkontakte' class="field__input" type="text" placeholder="https://vk.com/lilcitycompany" value="{{ user.vkontakte }}"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="form__foot"> |
||||
<button type="submit" class="form__btn btn btn_md">СОХРАНИТЬ</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<script> |
||||
var openFile = function(file) { |
||||
var input = file.target; |
||||
|
||||
var reader = new FileReader(); |
||||
reader.onload = function(){ |
||||
var dataURL = reader.result; |
||||
var output = document.getElementById('photo'); |
||||
output.src = dataURL; |
||||
}; |
||||
reader.readAsDataURL(input.files[0]); |
||||
}; |
||||
</script> |
||||
{% endblock content %} |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 793 B |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 793 B |
@ -0,0 +1,14 @@ |
||||
import $ from 'jquery'; |
||||
|
||||
$(document).ready(function () { |
||||
// Обработчик выбора пола
|
||||
let genderInput = $('#gender') |
||||
|
||||
$('div.js-select-option[data-gender-option]').on('click', function (e) { |
||||
e.preventDefault(); |
||||
const currentGender = $(this).attr('data-gender'); |
||||
$('[data-gender]').removeClass('active'); |
||||
$(`[data-gender=${currentGender}]`).addClass('active'); |
||||
genderInput.val(currentGender) |
||||
}); |
||||
}) |
||||
Loading…
Reference in new issue