license - check, list, create

remotes/origin/yandex
okt 12 years ago
parent 867aee4b00
commit 86a6333495
  1. 16
      project/customer/decorators.py
  2. 176
      project/customer/migrations/0004_auto__chg_field_licenseprice_price.py
  3. 176
      project/customer/migrations/0005_auto__chg_field_license_pay_sum.py
  4. 195
      project/customer/migrations/0006_auto__del_field_license_pay_date__add_field_license_order_date__add_fi.py
  5. 180
      project/customer/migrations/0007_auto__add_field_userprofile_active.py
  6. 67
      project/customer/models.py
  7. 2
      project/customer/urls.py
  8. 5
      project/customer/views/bank_accounts.py
  9. 6
      project/customer/views/bank_accounts_ajax.py
  10. 5
      project/customer/views/clients.py
  11. 5
      project/customer/views/clients_ajax.py
  12. 28
      project/customer/views/license.py
  13. 6
      project/customer/views/profile.py
  14. 3
      project/customer/views/profile_ajax.py
  15. 9
      project/docs/views/base_views.py
  16. 2
      project/static/css/style.css
  17. 1
      project/templates/customer/index.html
  18. 2
      project/templates/customer/profile/license.html
  19. 17
      project/templates/customer/profile/license_list.html
  20. 17
      project/templates/customer/profile/paid_list.html

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import user_passes_test
from django.core.urlresolvers import reverse
def license_required(function=None, redirect_field_name=None, login_url='/my/license/'):
"""
Проверка активности лицензии
"""
actual_decorator = user_passes_test(
lambda u: u.profile.active,
login_url=login_url,
redirect_field_name=redirect_field_name
)
if function:
return actual_decorator(function)
return actual_decorator

@ -0,0 +1,176 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'LicensePrice.price'
db.alter_column(u'customer_licenseprice', 'price', self.gf('django.db.models.fields.IntegerField')())
def backwards(self, orm):
# Changing field 'LicensePrice.price'
db.alter_column(u'customer_licenseprice', 'price', self.gf('django.db.models.fields.DecimalField')(max_digits=8, decimal_places=2))
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'bank_accounts'", 'to': u"orm['auth.User']"})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clients'", 'to': u"orm['auth.User']"})
},
u'customer.license': {
'Meta': {'object_name': 'License'},
'date_from': ('django.db.models.fields.DateField', [], {'null': 'True'}),
'date_to': ('django.db.models.fields.DateField', [], {'null': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'pay_date': ('django.db.models.fields.IntegerField', [], {}),
'pay_sum': ('django.db.models.fields.DecimalField', [], {'max_digits': '8', 'decimal_places': '2'}),
'payform': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'term': ('django.db.models.fields.IntegerField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'licenses'", 'to': u"orm['auth.User']"})
},
u'customer.licenseprice': {
'Meta': {'object_name': 'LicensePrice'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'payform': ('django.db.models.fields.IntegerField', [], {}),
'price': ('django.db.models.fields.IntegerField', [], {}),
'term': ('django.db.models.fields.IntegerField', [], {})
},
u'customer.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'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'}),
'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'}),
'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': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
},
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']"}),
'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_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'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile_filters'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
}
}
complete_apps = ['customer']

@ -0,0 +1,176 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'License.pay_sum'
db.alter_column(u'customer_license', 'pay_sum', self.gf('django.db.models.fields.IntegerField')())
def backwards(self, orm):
# Changing field 'License.pay_sum'
db.alter_column(u'customer_license', 'pay_sum', self.gf('django.db.models.fields.DecimalField')(max_digits=8, decimal_places=2))
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'bank_accounts'", 'to': u"orm['auth.User']"})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clients'", 'to': u"orm['auth.User']"})
},
u'customer.license': {
'Meta': {'object_name': 'License'},
'date_from': ('django.db.models.fields.DateField', [], {'null': 'True'}),
'date_to': ('django.db.models.fields.DateField', [], {'null': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'pay_date': ('django.db.models.fields.IntegerField', [], {}),
'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', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'licenses'", 'to': u"orm['auth.User']"})
},
u'customer.licenseprice': {
'Meta': {'object_name': 'LicensePrice'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'payform': ('django.db.models.fields.IntegerField', [], {}),
'price': ('django.db.models.fields.IntegerField', [], {}),
'term': ('django.db.models.fields.IntegerField', [], {})
},
u'customer.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'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'}),
'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'}),
'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': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
},
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']"}),
'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_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'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile_filters'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
}
}
complete_apps = ['customer']

@ -0,0 +1,195 @@
# -*- coding: utf-8 -*-
import 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 'License.pay_date'
db.delete_column(u'customer_license', 'pay_date')
# Adding field 'License.order_date'
db.add_column(u'customer_license', 'order_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2014, 6, 25, 0, 0), blank=True),
keep_default=False)
# Adding field 'License.paid_date'
db.add_column(u'customer_license', 'paid_date',
self.gf('django.db.models.fields.DateField')(null=True),
keep_default=False)
def backwards(self, orm):
# Adding field 'License.pay_date'
db.add_column(u'customer_license', 'pay_date',
self.gf('django.db.models.fields.IntegerField')(default=0),
keep_default=False)
# Deleting field 'License.order_date'
db.delete_column(u'customer_license', 'order_date')
# Deleting field 'License.paid_date'
db.delete_column(u'customer_license', 'paid_date')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'bank_accounts'", 'to': u"orm['auth.User']"})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clients'", 'to': u"orm['auth.User']"})
},
u'customer.license': {
'Meta': {'object_name': 'License'},
'date_from': ('django.db.models.fields.DateField', [], {'null': 'True'}),
'date_to': ('django.db.models.fields.DateField', [], {'null': 'True'}),
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'}),
'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', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'licenses'", 'to': u"orm['auth.User']"})
},
u'customer.licenseprice': {
'Meta': {'object_name': 'LicensePrice'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'payform': ('django.db.models.fields.IntegerField', [], {}),
'price': ('django.db.models.fields.IntegerField', [], {}),
'term': ('django.db.models.fields.IntegerField', [], {})
},
u'customer.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'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'}),
'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'}),
'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': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
},
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']"}),
'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_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'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile_filters'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
}
}
complete_apps = ['customer']

@ -0,0 +1,180 @@
# -*- coding: utf-8 -*-
import 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 'UserProfile.active'
db.add_column(u'customer_userprofile', 'active',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
def backwards(self, orm):
# Deleting field 'UserProfile.active'
db.delete_column(u'customer_userprofile', 'active')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'bank_accounts'", 'to': u"orm['auth.User']"})
},
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'}),
'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'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clients'", 'to': u"orm['auth.User']"})
},
u'customer.license': {
'Meta': {'object_name': 'License'},
'date_from': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'date_to': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
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'}),
'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', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'licenses'", 'to': u"orm['auth.User']"})
},
u'customer.licenseprice': {
'Meta': {'object_name': 'LicensePrice'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'payform': ('django.db.models.fields.IntegerField', [], {}),
'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'}),
'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'}),
'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': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
},
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']"}),
'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_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'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile_filters'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
}
}
complete_apps = ['customer']

@ -2,8 +2,11 @@
import os import os
from PIL import Image from PIL import Image
from pytils import numeral
from dateutil.relativedelta import relativedelta
from django.db import models from django.db import models
from django.db.models import Max
from django.contrib.auth.models import User from django.contrib.auth.models import User
from . import consts, managers from . import consts, managers
@ -97,6 +100,7 @@ class UserProfile(models.Model):
created_at = models.DateTimeField(u'Создан', auto_now_add=True) created_at = models.DateTimeField(u'Создан', auto_now_add=True)
updated_at = models.DateTimeField(u'Изменен', auto_now=True) updated_at = models.DateTimeField(u'Изменен', auto_now=True)
active = models.BooleanField(u'Активен', default=False)
objects = managers.UserProfileManager() objects = managers.UserProfileManager()
@ -333,25 +337,72 @@ class UserProfileFilters(models.Model):
class License(models.Model): class License(models.Model):
user = models.ForeignKey(User, related_name='licenses', verbose_name=u'пользователь') user = models.ForeignKey(User, related_name='licenses', verbose_name=u'пользователь')
term = models.IntegerField(verbose_name=u'срок лицензии') term = models.IntegerField(verbose_name=u'срок лицензии')
date_from = models.DateField(u'дата начала', null=True) date_from = models.DateField(u'дата начала', null=True, blank=True)
date_to = models.DateField(u'дата окончания', null=True) date_to = models.DateField(u'дата окончания', null=True, blank=True)
payform = models.IntegerField(verbose_name=u'форма оплаты', payform = models.IntegerField(verbose_name=u'форма оплаты',
choices=consts.PAYFORMS, default=0) choices=consts.PAYFORMS, default=0)
status = models.IntegerField(verbose_name=u'статус лицензии', status = models.IntegerField(verbose_name=u'статус лицензии',
choices=consts.LICENSE_STATUSES, default=0) choices=consts.LICENSE_STATUSES, default=0)
pay_date = models.IntegerField(verbose_name=u'дата оплаты') order_date = models.DateField(verbose_name=u'дата заказа', auto_now_add=True)
pay_sum = models.DecimalField(verbose_name=u'сумма оплаты', paid_date = models.DateField(verbose_name=u'дата оплаты', null=True)
max_digits=8, decimal_places=2) pay_sum= models.IntegerField(verbose_name=u'сумма оплаты')
#active = models.BooleanField(u'активный', default=False) #active = models.BooleanField(u'активный', default=False)
def __init__(self, *args, **kwargs):
super(License, self).__init__(*args, **kwargs)
self.__prev_date = self.paid_date
def __unicode__(self):
return u'%s - %s %s (%d %s)' % (
self.user.profile.get_company_name(),
self.term,
numeral.choose_plural(self.term, u"месяц, месяца, месяцев"),
self.pay_sum,
numeral.choose_plural(self.pay_sum, u"рубль, рубля, рублей"),
)
def save(self, *args, **kwargs):
if not self.__prev_date and self.paid_date:
max_date_license = License.objects.filter(user=self.user).aggregate(Max('date_to'))['date_to__max']
self.date_from = max_date_license + relativedelta(days=1)
self.date_to = self.date_from + relativedelta(months=self.term, days=-1)
self.user.profile.active = True
self.user.profile.save()
self.status = 1
super(License, self).save(*args, **kwargs)
def get_action(self):
if self.status == 0:
if self.payform == 0:
return u'Скачать счёт'
elif self.payform == 1:
return u'Оплатить счёт'
elif self.payform == 2:
return u'Скачать квитанцию'
elif self.status in [1, 2]:
return u'История операций'
else:
return ''
def get_paid_status(self):
if self.status == 1:
return u'Лицензия оплачена, ещё не активирована'
elif self.status == 2:
return u'Лицензия оплачена: осталось %d дней.'
class LicensePrice(models.Model): class LicensePrice(models.Model):
payform = models.IntegerField(verbose_name=u'форма оплаты', payform = models.IntegerField(verbose_name=u'форма оплаты',
choices=consts.PAYFORMS) choices=consts.PAYFORMS)
term = models.IntegerField(verbose_name=u'срок лицензии', term = models.IntegerField(verbose_name=u'срок лицензии',
choices=consts.TERMS) choices=consts.TERMS)
price = models.DecimalField(verbose_name=u'сумма оплаты', price = models.IntegerField(verbose_name=u'сумма оплаты')
max_digits=8, decimal_places=2)
def __unicode__(self): def __unicode__(self):
return u'%s (%d рублей)' % (self.term, self.price) return u'%s %s (%d %s)' % (self.term,
numeral.choose_plural(self.term, u"месяц, месяца, месяцев"),
self.price,
numeral.choose_plural(self.price, u"рубль, рубля, рублей"),
)

@ -16,6 +16,8 @@ urlpatterns = patterns('',
url(r'^profile/edit/$', profile.profile_edit, name='customer_profile_edit'), url(r'^profile/edit/$', profile.profile_edit, name='customer_profile_edit'),
url(r'^profile/email/$', profile.profile_email, name='customer_profile_email'), url(r'^profile/email/$', profile.profile_email, name='customer_profile_email'),
url(r'^license/$', license.order_license, name='customer_order_license'), url(r'^license/$', license.order_license, name='customer_order_license'),
url(r'^license_list/$', license.license_list, name='customer_license_list'),
url(r'^paid_list/$', license.paid_list, name='customer_paid_list'),
# --- профиль AJAX # --- профиль AJAX
url(r'^profile/filters/edit/ajax/$', profile_ajax.profile_filters_edit_ajax, name='customer_profile_filters_edit_ajax'), url(r'^profile/filters/edit/ajax/$', profile_ajax.profile_filters_edit_ajax, name='customer_profile_filters_edit_ajax'),

@ -7,9 +7,11 @@ from django.contrib.auth.decorators import login_required
from project.commons.paginator import pagination, save_per_page_value from project.commons.paginator import pagination, save_per_page_value
from .. import models, forms from .. import models, forms
from ..decorators import license_required
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
@save_per_page_value @save_per_page_value
def bank_accounts_list(request, page_num=None): def bank_accounts_list(request, page_num=None):
@ -21,6 +23,7 @@ def bank_accounts_list(request, page_num=None):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def bank_accounts_add(request): def bank_accounts_add(request):
"""Добавить расчетный счет.""" """Добавить расчетный счет."""
@ -53,6 +56,7 @@ def bank_accounts_add(request):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def bank_accounts_edit(request, id): def bank_accounts_edit(request, id):
"""Редактировать расчетный счет.""" """Редактировать расчетный счет."""
@ -86,6 +90,7 @@ def bank_accounts_edit(request, id):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def bank_accounts_delete(request, id): def bank_accounts_delete(request, id):
"""Удалить расчетный счет.""" """Удалить расчетный счет."""

@ -11,9 +11,11 @@ from django.core.urlresolvers import reverse
from project.commons.utils import dthandler from project.commons.utils import dthandler
from .. import models, forms from .. import models, forms
from ..decorators import license_required
@login_required @login_required
@license_required
def bank_accounts_list_ajax(request): def bank_accounts_list_ajax(request):
"""Список расчетных счетов пользователя - AJAX.""" """Список расчетных счетов пользователя - AJAX."""
if not request.is_ajax(): if not request.is_ajax():
@ -31,6 +33,7 @@ def bank_accounts_list_ajax(request):
@login_required @login_required
@license_required
def bank_accounts_get_ajax(request, id): def bank_accounts_get_ajax(request, id):
"""Получить счёт - AJAX. """Получить счёт - AJAX.
Если в форме редактирования счёта задан атрибут Meta.fields, то дампит только поля, перечисленные в нём. Если в форме редактирования счёта задан атрибут Meta.fields, то дампит только поля, перечисленные в нём.
@ -51,6 +54,7 @@ def bank_accounts_get_ajax(request, id):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def bank_accounts_add_ajax(request): def bank_accounts_add_ajax(request):
@ -79,6 +83,7 @@ def bank_accounts_add_ajax(request):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def bank_accounts_edit_ajax(request, id): def bank_accounts_edit_ajax(request, id):
@ -107,6 +112,7 @@ def bank_accounts_edit_ajax(request, id):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def bank_accounts_delete_ajax(request, id): def bank_accounts_delete_ajax(request, id):

@ -6,9 +6,11 @@ from django.contrib.auth.decorators import login_required
from project.commons.paginator import pagination, save_per_page_value from project.commons.paginator import pagination, save_per_page_value
from .. import models, forms from .. import models, forms
from ..decorators import license_required
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
@save_per_page_value @save_per_page_value
def clients_list(request, page_num=None): def clients_list(request, page_num=None):
@ -29,6 +31,7 @@ def clients_list(request, page_num=None):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def clients_add(request): def clients_add(request):
"""Добавить контрагента.""" """Добавить контрагента."""
@ -53,6 +56,7 @@ def clients_add(request):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def clients_edit(request, id): def clients_edit(request, id):
"""Редактировать контрагента.""" """Редактировать контрагента."""
@ -82,6 +86,7 @@ def clients_edit(request, id):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def clients_delete(request, id): def clients_delete(request, id):
"""Удалить контрагента.""" """Удалить контрагента."""

@ -8,9 +8,11 @@ from django.views.decorators.csrf import csrf_protect
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from .. import models, forms from .. import models, forms
from ..decorators import license_required
@login_required @login_required
@license_required
def clients_get_ajax(request, id): def clients_get_ajax(request, id):
"""Получить контрагента - AJAX. """Получить контрагента - AJAX.
Если в форме редактирования контрагента задан атрибут Meta.fields, то дампит только поля, перечисленные в нём. Если в форме редактирования контрагента задан атрибут Meta.fields, то дампит только поля, перечисленные в нём.
@ -30,6 +32,7 @@ def clients_get_ajax(request, id):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def clients_add_ajax(request): def clients_add_ajax(request):
@ -66,6 +69,7 @@ def clients_add_ajax(request):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def clients_edit_ajax(request, id): def clients_edit_ajax(request, id):
@ -95,6 +99,7 @@ def clients_edit_ajax(request, id):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def clients_delete_ajax(request, id): def clients_delete_ajax(request, id):

@ -19,6 +19,34 @@ def order_license(request):
dictionary = { dictionary = {
'form': form, 'form': form,
} }
if form.is_valid():
new_license = License(user=request.user,
term=form.cleaned_data['term'].term,
payform=form.cleaned_data['payform'],
pay_sum=form.cleaned_data['term'].price
)
new_license.save()
return render(request, template_name, dictionary) return render(request, template_name, dictionary)
def license_list(request):
"""Список счетов на лицензии
"""
template_name = 'customer/profile/license_list.html'
licenses = License.objects.filter(user=request.user)
dictionary = {
'licenses': licenses,
}
return render(request, template_name, dictionary)
def paid_list(request):
"""Список счетов на лицензии
"""
template_name = 'customer/profile/paid_list.html'
licenses = License.objects.filter(user=request.user, status__in=[1, 2, 3])
dictionary = {
'licenses': licenses,
}
return render(request, template_name, dictionary)

@ -12,6 +12,7 @@ from django.conf import settings
from project.commons.pdf_tools import render_pdf_to_string, pdf_to_response from project.commons.pdf_tools import render_pdf_to_string, pdf_to_response
from .. import models, forms from .. import models, forms
from ..decorators import license_required
PDF_PROFILE_NAME = u'Реквизиты.pdf' PDF_PROFILE_NAME = u'Реквизиты.pdf'
@ -20,6 +21,7 @@ SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '')
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@license_required
@login_required @login_required
@csrf_protect @csrf_protect
def profile_view(request): def profile_view(request):
@ -57,6 +59,7 @@ def profile_view(request):
@login_required @login_required
@license_required
@csrf_protect @csrf_protect
def profile_edit(request): def profile_edit(request):
"""Редактировать профиль пользователя.""" """Редактировать профиль пользователя."""
@ -90,6 +93,7 @@ def profile_edit(request):
@login_required @login_required
@license_required
def _profile_get_pdf(request, profile=None, account=None, filters=None): def _profile_get_pdf(request, profile=None, account=None, filters=None):
"""Создать профиль пользователя в PDF и вернуть как строку.""" """Создать профиль пользователя в PDF и вернуть как строку."""
template_name = 'customer/profile/as_pdf.html' template_name = 'customer/profile/as_pdf.html'
@ -102,6 +106,7 @@ def _profile_get_pdf(request, profile=None, account=None, filters=None):
@login_required @login_required
@license_required
def profile_as_pdf(request, profile=None, account=None, filters=None): def profile_as_pdf(request, profile=None, account=None, filters=None):
"""Вывести профиль пользователя в формате PDF в HttpResponse.""" """Вывести профиль пользователя в формате PDF в HttpResponse."""
pdf = _profile_get_pdf(request, profile, account, filters) pdf = _profile_get_pdf(request, profile, account, filters)
@ -122,6 +127,7 @@ def _send_profile_email(subject, to, body, pdf_content):
return email.send() return email.send()
@login_required
@login_required @login_required
@csrf_protect @csrf_protect
def profile_email(request): def profile_email(request):

@ -9,10 +9,12 @@ from django.contrib.auth.decorators import login_required
from .. import models, forms from .. import models, forms
from ..decorators import license_required
from .profile import _send_profile_email, _profile_get_pdf from .profile import _send_profile_email, _profile_get_pdf
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def profile_filters_edit_ajax(request): def profile_filters_edit_ajax(request):
@ -43,6 +45,7 @@ def profile_filters_edit_ajax(request):
@login_required @login_required
@license_required
@require_POST @require_POST
@csrf_protect @csrf_protect
def profile_email_ajax(request): def profile_email_ajax(request):

@ -28,6 +28,8 @@ from ..as_xls import render_xls_to_string
from ..forms import EmailForm, InvoicesListForm from ..forms import EmailForm, InvoicesListForm
from .. import filters from .. import filters
from project.customer.decorators import license_required
DEBUG = getattr(settings, 'DEBUG', False) DEBUG = getattr(settings, 'DEBUG', False)
SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '') SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '')
@ -182,6 +184,7 @@ class BaseViews(object):
dictionary['clients_form'] = ClientsListForm(self.request.user) dictionary['clients_form'] = ClientsListForm(self.request.user)
dictionary['invoices_form'] = InvoicesListForm(self.request.user) dictionary['invoices_form'] = InvoicesListForm(self.request.user)
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
@method_decorator(save_per_page_value) @method_decorator(save_per_page_value)
def list(self, *args, **kwargs): def list(self, *args, **kwargs):
@ -229,6 +232,7 @@ class BaseViews(object):
initial['doc_num'] = doc_num + 1 initial['doc_num'] = doc_num + 1
return initial return initial
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
def add(self, *args, **kwargs): def add(self, *args, **kwargs):
"""Добавить документ. """Добавить документ.
@ -277,6 +281,7 @@ class BaseViews(object):
kwargs['initial'].pop('updated_at', None) kwargs['initial'].pop('updated_at', None)
return self.add(self.request, *args, **kwargs) return self.add(self.request, *args, **kwargs)
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
def edit(self, *args, **kwargs): def edit(self, *args, **kwargs):
"""Редактировать документ.""" """Редактировать документ."""
@ -306,6 +311,7 @@ class BaseViews(object):
} }
return render(self.request, self.TEMPLATE_EDIT, dictionary) return render(self.request, self.TEMPLATE_EDIT, dictionary)
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
def delete(self, *args, **kwargs): def delete(self, *args, **kwargs):
"""Удалить документ.""" """Удалить документ."""
@ -434,6 +440,7 @@ class BaseViews(object):
) )
return False # что-то пошло не так return False # что-то пошло не так
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
def email(self, *args, **kwargs): def email(self, *args, **kwargs):
"""Отправить документ на email аттачем в заданном формате.""" """Отправить документ на email аттачем в заданном формате."""
@ -548,6 +555,7 @@ class BaseItemsViews(BaseViews):
"""Обновить родительскую модель.""" """Обновить родительскую модель."""
pass pass
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
def add(self, *args, **kwargs): def add(self, *args, **kwargs):
"""Добавить документ. """Добавить документ.
@ -643,6 +651,7 @@ class BaseItemsViews(BaseViews):
return self.add(self.request, *args, **kwargs) return self.add(self.request, *args, **kwargs)
@method_decorator(license_required)
@method_decorator(csrf_protect) @method_decorator(csrf_protect)
def edit(self, *args, **kwargs): def edit(self, *args, **kwargs):
"""Редактировать документ.""" """Редактировать документ."""

@ -203,3 +203,5 @@ table.list td { word-break: break-all; padding: 5px 0; }
/* blockUI */ /* blockUI */
div.blockOverlay { background: url('../img/ajax-loader.gif') no-repeat center center; z-index: 99999; } div.blockOverlay { background: url('../img/ajax-loader.gif') no-repeat center center; z-index: 99999; }
div.blockMsg { width: 100%; height: 100%; top: 0; left: 0; text-align: center; } div.blockMsg { width: 100%; height: 100%; top: 0; left: 0; text-align: center; }
.w100 {width:100px;}
.w200 {width:200px;}

@ -8,6 +8,7 @@
<a href="{% url 'customer_profile_view' %}">Реквизиты</a><br /><br /> <a href="{% url 'customer_profile_view' %}">Реквизиты</a><br /><br />
<a href="{% url 'customer_bank_accounts_list' %}">Расчётные счета</a><br /><br /> <a href="{% url 'customer_bank_accounts_list' %}">Расчётные счета</a><br /><br />
<a href="{% url 'customer_clients_list' %}">Контрагенты</a><br /><br /> <a href="{% url 'customer_clients_list' %}">Контрагенты</a><br /><br />
<a href="{% url 'customer_order_license' %}">Лицензии</a><br /><br />
</div> </div>
<div style="float:left; margin-left: 40px; border-left: 1px solid; padding-left: 20px;"> <div style="float:left; margin-left: 40px; border-left: 1px solid; padding-left: 20px;">

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load pytils_numeral %}
{% block title %}Купить лицензию{% endblock %} {% block title %}Купить лицензию{% endblock %}
{% block content %} {% block content %}

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% load pytils_numeral %}
{% block title %}Купить лицензию{% endblock %}
{% block content %}
{% for license in licenses %}
<div>
<div class='w100 left'>{{ license.id }}</div>
<div class='w100 left'>{{ license.order_date }}</div>
<div class='w100 left'>{{ license.term }}</div>
<div class='w100 left'>{{ license.get_payform_display }}</div>
<div class='w100 left'>{{ license.get_status_display }}</div>
<div class='w100 left'>{{ license.get_action }}</div>
<div class='clear'></div>
</div>
{% endfor %}
{% endblock %}

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% load pytils_numeral %}
{% block title %}Купить лицензию{% endblock %}
{% block content %}
{% for license in licenses %}
<div>
<div class='w100 left'>{{ license.paid_date }}</div>
<div class='w100 left'>{{ license.id }}</div>
<div class='w100 left'>{{ license.pay_sum }}</div>
<div class='w100 left'>{{ license.term }}</div>
<div class='w200 left'>{{ license.date_from }} - {{ license.date_to }}</div>
<div class='w100 left'>{{ license.get_status_display }}</div>
<div class='clear'></div>
</div>
{% endfor %}
{% endblock %}
Loading…
Cancel
Save