commit
717d497010
18 changed files with 139 additions and 133 deletions
@ -0,0 +1,19 @@ |
|||||||
|
# Generated by Django 2.0.4 on 2018-05-07 14:22 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
import django.db.models.deletion |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('course', '0036_auto_20180426_1256'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AlterField( |
||||||
|
model_name='course', |
||||||
|
name='category', |
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='courses', to='course.Category'), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
{% load static %} {% load thumbnail %} |
||||||
|
{% if request.user.is_authenticated %} |
||||||
|
<div class="header__login"> |
||||||
|
<div class="header__ava ava"> |
||||||
|
{% thumbnail request.user.photo "48x48" crop="center" as im %} |
||||||
|
<img class="ava__pic" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" /> |
||||||
|
{% empty %} |
||||||
|
<img class="ava__pic" src="{% static 'img/user_default.jpg' %}" width="48px" height="48px" /> |
||||||
|
{% endthumbnail %} |
||||||
|
</div> |
||||||
|
<div class="header__drop"> |
||||||
|
{% if request.user.role >= request.user.AUTHOR_ROLE %} |
||||||
|
<a class="header__link header__link_border" href="{% url 'user-edit-payments' request.user.id %}"> |
||||||
|
{{ request.user.balance }} руб. |
||||||
|
</a> |
||||||
|
{% if request.user.auth_token %} |
||||||
|
{% if request.user.role >= request.user.AUTHOR_ROLE %} |
||||||
|
<a class="header__link header__link_green" href="{% url 'course_create' %}"> |
||||||
|
<div class="header__title">ДОБАВИТЬ КУРС</div> |
||||||
|
</a> |
||||||
|
{% endif %} |
||||||
|
{% if request.user.role >= request.user.TEACHER_ROLE %} |
||||||
|
<a class="header__link" href="{% url 'school:lessons' %}"> |
||||||
|
<div class="header__title">УРОКИ ШКОЛЫ</div> |
||||||
|
</a> |
||||||
|
{% endif %} |
||||||
|
{% endif %} |
||||||
|
{% endif %} |
||||||
|
<a class="header__link" href="{% url 'user' request.user.id %}"> |
||||||
|
<div class="header__title">ПРОФИЛЬ</div> |
||||||
|
</a> |
||||||
|
<a class="header__link" href="{% url 'lilcity:logout' %}"> |
||||||
|
<div class="header__title">ВЫЙТИ</div> |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% else %} |
||||||
|
<button class="header__enter js-header-enter" data-popup=".js-popup-auth">ВХОД |
||||||
|
<svg class="icon icon-user"> |
||||||
|
<use xlink:href={% static "img/sprite.svg" %}#icon-user></use> |
||||||
|
</svg> |
||||||
|
</button> |
||||||
|
{% endif %} |
||||||
@ -1,3 +1,4 @@ |
|||||||
export const ROLE_USER = 0; |
export const ROLE_USER = 0; |
||||||
export const ROLE_AUTHOR = 1; |
export const ROLE_AUTHOR = 1; |
||||||
export const ROLE_ADMIN = 2; |
export const ROLE_TEACHER = 2; |
||||||
|
export const ROLE_ADMIN = 3; |
||||||
Loading…
Reference in new issue