Browse Source

убрал лишние поля

devel
Dmitry 9 years ago
parent
commit
bffe354bb8
  1. 2
      abonapp/forms.py
  2. 3
      abonapp/models.py
  3. 13
      templates/abonapp/group_list.html

2
abonapp/forms.py

@ -55,7 +55,7 @@ class AbonForm(forms.Form):
class AbonGroupForm(forms.ModelForm): class AbonGroupForm(forms.ModelForm):
class Meta: class Meta:
model = models.AbonGroup model = models.AbonGroup
fields = ['title', 'address']
fields = '__all__'
widgets = { widgets = {
'class': 'form-control' 'class': 'form-control'
} }

3
abonapp/models.py

@ -28,8 +28,7 @@ class LogicError(Exception):
class AbonGroup(models.Model): 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: class Meta:
db_table = 'abonent_groups' db_table = 'abonent_groups'

13
templates/abonapp/group_list.html

@ -21,13 +21,7 @@
</a> </a>
{% if order_by == 'title' %}<span class="glyphicon glyphicon-filter"></span>{% endif %} {% if order_by == 'title' %}<span class="glyphicon glyphicon-filter"></span>{% endif %}
</th> </th>
<th>
<a href="{% url 'abongroup_list_link' %}?order_by=address&dir={{ dir|default:"down" }}">
Адресс группы
</a>
{% if order_by == 'address' %}<span class="glyphicon glyphicon-filter"></span>{% endif %}
</th>
<th>
<th width="100">
Количество абонентов Количество абонентов
</th> </th>
<th width="100">Do</th> <th width="100">Do</th>
@ -38,7 +32,6 @@
<tr> <tr>
<td>{{ gr.id }}</td> <td>{{ gr.id }}</td>
<td><a href="{% url 'people_list_link' gr.id %}">{{ gr.title }}</a></td> <td><a href="{% url 'people_list_link' gr.id %}">{{ gr.title }}</a></td>
<td>{{ gr.address }}</td>
<td>{{ gr.usercount }}</td> <td>{{ gr.usercount }}</td>
<td> <td>
{% if gr.usercount > 0 %} {% if gr.usercount > 0 %}
@ -51,13 +44,13 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="5"><a href="#">Ещё нет групп</a></td>
<td colspan="4"><a href="#">Ещё нет групп</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="5" class="btn-group">
<td colspan="4" class="btn-group">
<a href="{% url 'addgroup_link' %}" class="btn btn-success btn-sm"> <a href="{% url 'addgroup_link' %}" class="btn btn-success btn-sm">
<span class="glyphicon glyphicon-plus"></span> Создать группу <span class="glyphicon glyphicon-plus"></span> Создать группу
</a> </a>

Loading…
Cancel
Save