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 %} - + Создать группу