diff --git a/common/migrations/0010_tooltip_position.py b/common/migrations/0010_tooltip_position.py new file mode 100644 index 0000000..fdaf774 --- /dev/null +++ b/common/migrations/0010_tooltip_position.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-29 19:24 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('common', '0009_merge'), + ] + + operations = [ + migrations.AddField( + model_name='tooltip', + name='position', + field=models.CharField(choices=[('left', 'Слева'), ('right', 'Справа'), ('top', 'Сверху'), ('bottom', 'Снизу')], default='top', max_length=255), + ), + ] diff --git a/common/models.py b/common/models.py index 04ecdbd..43b73dc 100644 --- a/common/models.py +++ b/common/models.py @@ -86,9 +86,17 @@ class PrintDocuments(models.Model): class Tooltip(models.Model): + POSITIONS = ( + ('left', 'Слева'), + ('right', 'Справа'), + ('top', 'Сверху'), + ('bottom', 'Снизу'), + ) + name = models.CharField(max_length=255, unique=True) text = models.TextField(blank=True) example = models.TextField(blank=True) + position = models.CharField(max_length=255, choices=POSITIONS, default='top') class Meta: verbose_name = 'Подсказка' diff --git a/common/templatetags/common_tags.py b/common/templatetags/common_tags.py index b418eea..03fd88c 100644 --- a/common/templatetags/common_tags.py +++ b/common/templatetags/common_tags.py @@ -100,4 +100,11 @@ def tooltip(**kwargs): return tooltip.text +@register.simple_tag +def tooltip_placement(**kwargs): + tooltip = util.get_or_none(Tooltip, **kwargs) + + if tooltip: + return tooltip.position + # import code; code.interact(local=dict(globals(), **locals())) diff --git a/projects/templates/customer_project_create.html b/projects/templates/customer_project_create.html index 95e6024..e8d6c62 100644 --- a/projects/templates/customer_project_create.html +++ b/projects/templates/customer_project_create.html @@ -24,12 +24,12 @@
Название заказа {{ form.name.errors.as_text }}
Подробно опишите задание {{ form.text.errors.as_text }}
Тип работы {{ form.work_type.errors.as_text }}
-Требуется допуск (СРО)