From bffe354bb8beda15c8a2404730a6bb5d1093435c Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 6 Dec 2016 21:32:14 +0000 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BB=D0=B8?= =?UTF-8?q?=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abonapp/forms.py | 2 +- abonapp/models.py | 3 +-- templates/abonapp/group_list.html | 13 +++---------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/abonapp/forms.py b/abonapp/forms.py index 8afdd1d..6f5107f 100644 --- a/abonapp/forms.py +++ b/abonapp/forms.py @@ -55,7 +55,7 @@ class AbonForm(forms.Form): class AbonGroupForm(forms.ModelForm): class Meta: model = models.AbonGroup - fields = ['title', 'address'] + fields = '__all__' widgets = { 'class': 'form-control' } diff --git a/abonapp/models.py b/abonapp/models.py index c6a33e8..61340a1 100644 --- a/abonapp/models.py +++ b/abonapp/models.py @@ -28,8 +28,7 @@ class LogicError(Exception): class AbonGroup(models.Model): - title = models.CharField(max_length=127) - address = models.CharField(max_length=256, blank=True, null=True) + title = models.CharField(max_length=127, unique=True) class Meta: db_table = 'abonent_groups' diff --git a/templates/abonapp/group_list.html b/templates/abonapp/group_list.html index 79e6047..67fe923 100644 --- a/templates/abonapp/group_list.html +++ b/templates/abonapp/group_list.html @@ -21,13 +21,7 @@ {% if order_by == 'title' %}{% endif %} - - - Адресс группы - - {% if order_by == 'address' %}{% endif %} - - + Количество абонентов Do @@ -38,7 +32,6 @@ {{ gr.id }} {{ gr.title }} - {{ gr.address }} {{ gr.usercount }} {% if gr.usercount > 0 %} @@ -51,13 +44,13 @@ {% empty %} - Ещё нет групп + Ещё нет групп {% endfor %} - + Создать группу