client: deleted field contact_icq 2) added field ogrn; migrate

remotes/origin/mitri4
apache 9 years ago
parent 1fba1a2607
commit 1ca28baa9f
  1. 4
      project/customer/admin.py
  2. 5
      project/customer/forms.py
  3. 156
      project/customer/migrations/0004_auto__del_field_client_contact_icq__add_field_client_ogrn.py
  4. 3
      project/customer/models.py
  5. 22
      project/templates/customer/clients/form.html

@ -49,13 +49,13 @@ class ClientAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['company',]}),
(None, {'fields': ['name', 'inn', 'address',]}),
(None, {'fields': ['name', 'inn', 'address', 'ogrn',]}),
(u'ИП', {'fields': ['okpo',]}),
(u'Организация', {'fields': ['kpp',]}),
(u'Банковские реквизиты',
{'fields': ['bank_bik', 'bank_name', 'bank_address', 'bank_korr_account', 'bank_account',]}),
(u'Контакты',
{'fields': ['contact_name', 'contact_email', 'contact_phone', 'contact_icq', 'contact_skype',
{'fields': ['contact_name', 'contact_email', 'contact_phone', 'contact_skype',
'contact_other',]}),
]

@ -211,11 +211,11 @@ class ClientForm(forms.ModelForm):
"""Форма редактирования контрагентов."""
class Meta:
model = models.Client
fields = ('name', 'inn', 'kpp', 'okpo', 'address',
fields = ('name', 'inn', 'kpp', 'ogrn', 'okpo', 'address',
# банковские реквизиты
'bank_bik', 'bank_name', 'bank_address', 'bank_korr_account', 'bank_account',
# контакты
'contact_name', 'contact_email', 'contact_phone', 'contact_icq', 'contact_skype', 'contact_other',
'contact_name', 'contact_email', 'contact_phone', 'contact_skype', 'contact_other',
)
_textarea = forms.Textarea(attrs={'cols': 80, 'rows': 3})
widgets = {
@ -230,6 +230,7 @@ class ClientForm(forms.ModelForm):
super(ClientForm, self).__init__(*args, **kwargs)
self.fields['inn'].widget.attrs.update(_numeric(self.fields['inn']))
self.fields['kpp'].widget.attrs.update(_numeric(self.fields['kpp']))
self.fields['ogrn'].widget.attrs.update(_numeric(self.fields['ogrn']))
self.fields['okpo'].widget.attrs.update(_numeric(self.fields['okpo']))
self.fields['bank_bik'].widget.attrs.update(_numeric(self.fields['bank_bik']))
self.fields['bank_korr_account'].widget.attrs.update(_numeric(self.fields['bank_korr_account']))

@ -0,0 +1,156 @@
# -*- 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):
# Deleting field 'Client.contact_icq'
db.delete_column(u'customer_client', 'contact_icq')
# Adding field 'Client.ogrn'
db.add_column(u'customer_client', 'ogrn',
self.gf('django.db.models.fields.CharField')(default='', max_length=15),
keep_default=False)
def backwards(self, orm):
# Adding field 'Client.contact_icq'
db.add_column(u'customer_client', 'contact_icq',
self.gf('django.db.models.fields.CharField')(default='', max_length=20, blank=True),
keep_default=False)
# Deleting field 'Client.ogrn'
db.delete_column(u'customer_client', 'ogrn')
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_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'}),
'ogrn': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '15'}),
'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']

@ -306,6 +306,7 @@ class Client(models.Model):
name = models.CharField(u'Наименование', max_length=256, db_index=True)
inn = models.CharField(u'ИНН', max_length=12)
kpp = models.CharField(u'КПП', max_length=9, blank=True, default='') # Организация
ogrn = models.CharField(u'ОГРН', max_length=15, default='')
okpo = models.CharField(u'ОКПО', max_length=10, blank=True, default='') # ИП
address = models.CharField(u'Юр. адрес', max_length=256)
@ -320,7 +321,6 @@ class Client(models.Model):
contact_name = models.CharField(u'Имя', max_length=50, blank=True, default='')
contact_email = models.EmailField(u'E-mail', max_length=50, blank=True, default='')
contact_phone = models.CharField(u'Телефон', max_length=50, blank=True, default='')
contact_icq = models.CharField(u'ICQ', max_length=20, blank=True, default='')
contact_skype = models.CharField(u'Skype', max_length=20, blank=True, default='')
contact_other = models.CharField(u'Другое', max_length=256, blank=True, default='')
@ -340,6 +340,7 @@ class Client(models.Model):
def save(self, *args, **kwargs):
self.inn = only_numerics(self.inn)
self.kpp = only_numerics(self.kpp)
self.ogrn = only_numerics(self.ogrn)
self.okpo = only_numerics(self.okpo)
self.bank_bik = only_numerics(self.bank_bik)
self.bank_korr_account = only_numerics(self.bank_korr_account)

@ -49,6 +49,17 @@
<div class="clear"></div>
</div>
<div id="ogrn" class="field">
<div class="left label">
ОГРН{% if form.ogrn.field.required %}<span class="required">*</span>{% endif %}:
</div>
<div class="form-field">
{{ form.ogrn }}
{% if not is_ajax %}{{ form.ogrn.errors }}{% endif %}
</div>
<div class="clear"></div>
</div>
<div id="okpo" class="field">
<div class="left label">
ОКПО{% if form.okpo.field.required %}<span class="required">*</span>{% endif %}:
@ -163,17 +174,6 @@
<div class="clear"></div>
</div>
<div id="contact_icq" class="field">
<div class="left label">
ICQ{% if form.contact_icq.field.required %}<span class="required">*</span>{% endif %}:
</div>
<div class="form-field">
{{ form.contact_icq }}
{% if not is_ajax %}{{ form.contact_icq.errors }}{% endif %}
</div>
<div class="clear"></div>
</div>
<div id="contact_skype" class="field">
<div class="left label">
Skype{% if form.contact_skype.field.required %}<span class="required">*</span>{% endif %}:

Loading…
Cancel
Save