diff --git a/abonapp/forms.py b/abonapp/forms.py index 1e25604..7618da6 100644 --- a/abonapp/forms.py +++ b/abonapp/forms.py @@ -158,15 +158,15 @@ class ExportUsersForm(forms.Form): ('fio', _('fio')), ('ip_address', _('Ip Address')), ('description', _('Comment')), - ('street', _('Street')), + ('street__name', _('Street')), ('house', _('House')), ('birth_day', _('birth day')), ('is_active', _('Is active')), ('telephone', _('Telephone')), - ('current_tariff', _('Service title')), + ('current_tariff__tariff__title', _('Service title')), ('ballance', _('Ballance')), - ('device', _('Device')), - ('dev_port', _('Device port')), + ('device__comment', _('Device')), + ('dev_port__descr', _('Device port')), ('is_dynamic_ip', _('Is dynamic ip')) ) fields = forms.MultipleChoiceField(choices=FIELDS_CHOICES, diff --git a/abonapp/templates/abonapp/peoples.html b/abonapp/templates/abonapp/peoples.html index 7b49cbf..f69d853 100644 --- a/abonapp/templates/abonapp/peoples.html +++ b/abonapp/templates/abonapp/peoples.html @@ -136,6 +136,9 @@ {% trans 'Phonebook' %} + + {% trans 'Export users' %} + diff --git a/abonapp/views.py b/abonapp/views.py index f21e01a..99980a5 100644 --- a/abonapp/views.py +++ b/abonapp/views.py @@ -923,6 +923,8 @@ def abon_export(request, gid): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="users.csv"' writer = csv.writer(response, quoting=csv.QUOTE_NONNUMERIC) + display_values = [f[1] for f in frm.fields['fields'].choices if f[0] in fields] + writer.writerow(display_values) for row in subscribers: writer.writerow(row) return response