From 1fba1a2607ca1f665314acf25ea7687fd0a32df8 Mon Sep 17 00:00:00 2001 From: apache Date: Sun, 12 Feb 2017 17:34:36 +0300 Subject: [PATCH] display address on customer profile --- project/customer/forms.py | 5 + ...d_field_userprofilefilters_show_address.py | 148 ++++++++++++++++++ project/customer/models.py | 1 + .../templates/customer/profile/as_pdf.html | 2 +- project/templates/customer/profile/view.html | 13 +- 5 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 project/customer/migrations/0003_auto__add_field_userprofilefilters_show_address.py diff --git a/project/customer/forms.py b/project/customer/forms.py index c05094e..8ab9391 100644 --- a/project/customer/forms.py +++ b/project/customer/forms.py @@ -286,6 +286,7 @@ class UserProfileFiltersForm(MyBaseModelForm): new_initial['show_ogrn'] = bool(profile.ogrn) new_initial['show_okpo'] = bool(profile.okpo) new_initial['show_glavbuh'] = bool(profile.get_glavbuh_fio()) + new_initial['show_address'] = bool(profile.address) new_initial['show_jur_address'] = bool(profile.jur_address) new_initial['show_real_address'] = bool(profile.real_address) new_initial['show_phone'] = bool(profile.get_full_phone()) @@ -307,6 +308,7 @@ class UserProfileFiltersForm(MyBaseModelForm): new_initial['show_ogrn'] = bool(profile.ogrn) new_initial['show_okpo'] = bool(profile.okpo) new_initial['show_glavbuh'] = bool(profile.get_glavbuh_fio()) + new_initial['show_address'] = bool(profile.address) new_initial['show_jur_address'] = bool(profile.jur_address) new_initial['show_real_address'] = bool(profile.real_address) new_initial['show_phone'] = bool(profile.get_full_phone()) @@ -356,6 +358,7 @@ class UserProfileFiltersForm(MyBaseModelForm): if not profile.ogrn: f['show_ogrn'].widget.attrs['disabled'] = 'disabled' if not profile.okpo: f['show_okpo'].widget.attrs['disabled'] = 'disabled' if not profile.get_glavbuh_fio(): f['show_glavbuh'].widget.attrs['disabled'] = 'disabled' + if not profile.address: f['show_address'].widget.attrs['disabled'] = 'disabled' if not profile.jur_address: f['show_jur_address'].widget.attrs['disabled'] = 'disabled' if not profile.real_address: f['show_real_address'].widget.attrs['disabled'] = 'disabled' if not profile.get_full_phone(): f['show_phone'].widget.attrs['disabled'] = 'disabled' @@ -404,6 +407,7 @@ class IpUserProfileFiltersForm(UserProfileFiltersForm): 'show_bank_account', 'bank_account', 'show_contact_info', + 'show_address', 'show_jur_address', 'show_real_address', 'show_phone', @@ -438,6 +442,7 @@ class OrgUserProfileFiltersForm(UserProfileFiltersForm): 'show_bank_account', 'bank_account', 'show_contact_info', + 'show_address', 'show_jur_address', 'show_real_address', 'show_phone', diff --git a/project/customer/migrations/0003_auto__add_field_userprofilefilters_show_address.py b/project/customer/migrations/0003_auto__add_field_userprofilefilters_show_address.py new file mode 100644 index 0000000..e7828b9 --- /dev/null +++ b/project/customer/migrations/0003_auto__add_field_userprofilefilters_show_address.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'UserProfileFilters.show_address' + db.add_column(u'customer_userprofilefilters', 'show_address', + self.gf('django.db.models.fields.BooleanField')(default=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'UserProfileFilters.show_address' + db.delete_column(u'customer_userprofilefilters', 'show_address') + + + models = { + u'customer.bankaccount': { + 'Meta': {'ordering': "['-created_at']", 'object_name': 'BankAccount'}, + 'account': ('django.db.models.fields.CharField', [], {'max_length': '20'}), + 'address': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'bik': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'company': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'bank_accounts'", 'to': u"orm['customer.UserProfile']"}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'korr_account': ('django.db.models.fields.CharField', [], {'max_length': '20'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + u'customer.client': { + 'Meta': {'ordering': "['name', '-created_at']", 'object_name': 'Client'}, + 'address': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'bank_account': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'bank_address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'bank_bik': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'bank_korr_account': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'bank_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'company': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clients'", 'to': u"orm['customer.UserProfile']"}), + 'contact_email': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}), + 'contact_icq': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'contact_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}), + 'contact_other': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'contact_phone': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}), + 'contact_skype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inn': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'kpp': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '9', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}), + 'okpo': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + u'customer.license': { + 'Meta': {'object_name': 'License'}, + 'company': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'licenses'", 'to': u"orm['customer.UserProfile']"}), + 'date_from': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'date_to': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order_date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'paid_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'pay_sum': ('django.db.models.fields.IntegerField', [], {}), + 'payform': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'term': ('django.db.models.fields.IntegerField', [], {}) + }, + u'customer.licenseprice': { + 'Meta': {'object_name': 'LicensePrice'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'price': ('django.db.models.fields.IntegerField', [], {}), + 'term': ('django.db.models.fields.IntegerField', [], {}) + }, + u'customer.userprofile': { + 'Meta': {'object_name': 'UserProfile'}, + 'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}), + 'boss_midname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}), + 'boss_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}), + 'boss_sign': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'boss_surname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}), + 'boss_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '75', 'blank': 'True'}), + 'fax': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'fax_code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'full_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'glavbuh_midname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30', 'blank': 'True'}), + 'glavbuh_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30', 'blank': 'True'}), + 'glavbuh_sign': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'glavbuh_surname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inn': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '12'}), + 'ip_reg_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'jur_address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'kpp': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '9'}), + 'logo': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'na_osnovanii': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}), + 'ogrn': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '15'}), + 'okpo': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'phone': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'phone_code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'profile_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {}), + 'real_address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'site': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'stamp': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'svid_gos_reg': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'user_session_key': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}) + }, + u'customer.userprofilefilters': { + 'Meta': {'object_name': 'UserProfileFilters'}, + 'bank_account': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'+'", 'null': 'True', 'blank': 'True', 'to': u"orm['customer.BankAccount']"}), + 'company': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile_filters'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['customer.UserProfile']"}), + 'show_address': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_bank_account': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_contact_info': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_email': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_fax': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_full_name': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_glavbuh': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_inn': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_ip_boss_fio': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_ip_reg_date': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_jur_address': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_kpp': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_logo': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_na_osnovanii': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_name': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_ogrn': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_okpo': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_org_boss_title_and_fio': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_phone': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_profile_type': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_real_address': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_site': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_svid_gos_reg': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + } + } + + complete_apps = ['customer'] \ No newline at end of file diff --git a/project/customer/models.py b/project/customer/models.py index b95521d..581c2ed 100644 --- a/project/customer/models.py +++ b/project/customer/models.py @@ -372,6 +372,7 @@ class UserProfileFilters(models.Model): null=True, default=None) show_contact_info = models.BooleanField(u'Контактная информация', default=True) + show_address = models.BooleanField(u'Фактический адрес', default=True) show_jur_address = models.BooleanField(u'Юридический адрес', default=True) show_real_address = models.BooleanField(u'Почтовый адрес', default=True) show_phone = models.BooleanField(u'Телефон', default=True) diff --git a/project/templates/customer/profile/as_pdf.html b/project/templates/customer/profile/as_pdf.html index 28c2596..6c124bd 100644 --- a/project/templates/customer/profile/as_pdf.html +++ b/project/templates/customer/profile/as_pdf.html @@ -73,8 +73,8 @@ {% if filters.show_contact_info %}
+ {% if filters.show_address %}Фактический адрес: {{ profile.address }}
{% endif %} {% if filters.show_jur_address %}Юридический адрес: {{ profile.jur_address }}
{% endif %} - {% if filters.show_real_address %}Почтовый адрес: {{ profile.real_address }}
{% endif %} {% if filters.show_phone %}Телефон: {{ profile.get_full_phone }}
{% endif %} diff --git a/project/templates/customer/profile/view.html b/project/templates/customer/profile/view.html index e57580e..9b8a6be 100644 --- a/project/templates/customer/profile/view.html +++ b/project/templates/customer/profile/view.html @@ -83,13 +83,9 @@
- {% if profile.jur_address %} -
Юридический адрес: {{ profile.jur_address }}
- {% endif %} - - {% if profile.real_address %} -
Почтовый адрес: {{ profile.real_address }}
- {% endif %} + {% if profile.address %}
Фактический адрес: {{ profile.address }}
{% endif %} + {% if profile.jur_address %}
Юридический адрес: {{ profile.jur_address }}
{% endif %} + {% if profile.real_address %}
Почтовый адрес: {{ profile.real_address }}
{% endif %} {% if profile.get_full_phone %}
Телефон: {{ profile.get_full_phone }}
{% endif %} {% if profile.get_full_fax %}
Факс: {{ profile.get_full_fax }}
{% endif %} @@ -174,6 +170,9 @@
+
+