diff --git a/project/customer/decorators.py b/project/customer/decorators.py new file mode 100644 index 0000000..b2051ca --- /dev/null +++ b/project/customer/decorators.py @@ -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 diff --git a/project/customer/migrations/0004_auto__chg_field_licenseprice_price.py b/project/customer/migrations/0004_auto__chg_field_licenseprice_price.py new file mode 100644 index 0000000..885c839 --- /dev/null +++ b/project/customer/migrations/0004_auto__chg_field_licenseprice_price.py @@ -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'] \ No newline at end of file diff --git a/project/customer/migrations/0005_auto__chg_field_license_pay_sum.py b/project/customer/migrations/0005_auto__chg_field_license_pay_sum.py new file mode 100644 index 0000000..34517b1 --- /dev/null +++ b/project/customer/migrations/0005_auto__chg_field_license_pay_sum.py @@ -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'] \ No newline at end of file diff --git a/project/customer/migrations/0006_auto__del_field_license_pay_date__add_field_license_order_date__add_fi.py b/project/customer/migrations/0006_auto__del_field_license_pay_date__add_field_license_order_date__add_fi.py new file mode 100644 index 0000000..c352460 --- /dev/null +++ b/project/customer/migrations/0006_auto__del_field_license_pay_date__add_field_license_order_date__add_fi.py @@ -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'] \ No newline at end of file diff --git a/project/customer/migrations/0007_auto__add_field_userprofile_active.py b/project/customer/migrations/0007_auto__add_field_userprofile_active.py new file mode 100644 index 0000000..df239f4 --- /dev/null +++ b/project/customer/migrations/0007_auto__add_field_userprofile_active.py @@ -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'] \ No newline at end of file diff --git a/project/customer/models.py b/project/customer/models.py index 590ea13..2273b9a 100644 --- a/project/customer/models.py +++ b/project/customer/models.py @@ -2,8 +2,11 @@ import os from PIL import Image +from pytils import numeral +from dateutil.relativedelta import relativedelta from django.db import models +from django.db.models import Max from django.contrib.auth.models import User from . import consts, managers @@ -97,6 +100,7 @@ class UserProfile(models.Model): created_at = models.DateTimeField(u'Создан', auto_now_add=True) updated_at = models.DateTimeField(u'Изменен', auto_now=True) + active = models.BooleanField(u'Активен', default=False) objects = managers.UserProfileManager() @@ -333,25 +337,72 @@ class UserProfileFilters(models.Model): class License(models.Model): user = models.ForeignKey(User, related_name='licenses', verbose_name=u'пользователь') term = models.IntegerField(verbose_name=u'срок лицензии') - date_from = models.DateField(u'дата начала', null=True) - date_to = models.DateField(u'дата окончания', null=True) + date_from = models.DateField(u'дата начала', null=True, blank=True) + date_to = models.DateField(u'дата окончания', null=True, blank=True) payform = models.IntegerField(verbose_name=u'форма оплаты', choices=consts.PAYFORMS, default=0) status = models.IntegerField(verbose_name=u'статус лицензии', choices=consts.LICENSE_STATUSES, default=0) - pay_date = models.IntegerField(verbose_name=u'дата оплаты') - pay_sum = models.DecimalField(verbose_name=u'сумма оплаты', - max_digits=8, decimal_places=2) + order_date = models.DateField(verbose_name=u'дата заказа', auto_now_add=True) + paid_date = models.DateField(verbose_name=u'дата оплаты', null=True) + pay_sum= models.IntegerField(verbose_name=u'сумма оплаты') #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): payform = models.IntegerField(verbose_name=u'форма оплаты', choices=consts.PAYFORMS) term = models.IntegerField(verbose_name=u'срок лицензии', choices=consts.TERMS) - price = models.DecimalField(verbose_name=u'сумма оплаты', - max_digits=8, decimal_places=2) + price = models.IntegerField(verbose_name=u'сумма оплаты') 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"рубль, рубля, рублей"), + ) + diff --git a/project/customer/urls.py b/project/customer/urls.py index 9ce10f2..6295b10 100644 --- a/project/customer/urls.py +++ b/project/customer/urls.py @@ -16,6 +16,8 @@ urlpatterns = patterns('', url(r'^profile/edit/$', profile.profile_edit, name='customer_profile_edit'), url(r'^profile/email/$', profile.profile_email, name='customer_profile_email'), 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 url(r'^profile/filters/edit/ajax/$', profile_ajax.profile_filters_edit_ajax, name='customer_profile_filters_edit_ajax'), diff --git a/project/customer/views/bank_accounts.py b/project/customer/views/bank_accounts.py index cb9f9f9..7e01a4d 100644 --- a/project/customer/views/bank_accounts.py +++ b/project/customer/views/bank_accounts.py @@ -7,9 +7,11 @@ from django.contrib.auth.decorators import login_required from project.commons.paginator import pagination, save_per_page_value from .. import models, forms +from ..decorators import license_required @login_required +@license_required @csrf_protect @save_per_page_value def bank_accounts_list(request, page_num=None): @@ -21,6 +23,7 @@ def bank_accounts_list(request, page_num=None): @login_required +@license_required @csrf_protect def bank_accounts_add(request): """Добавить расчетный счет.""" @@ -53,6 +56,7 @@ def bank_accounts_add(request): @login_required +@license_required @csrf_protect def bank_accounts_edit(request, id): """Редактировать расчетный счет.""" @@ -86,6 +90,7 @@ def bank_accounts_edit(request, id): @login_required +@license_required @csrf_protect def bank_accounts_delete(request, id): """Удалить расчетный счет.""" diff --git a/project/customer/views/bank_accounts_ajax.py b/project/customer/views/bank_accounts_ajax.py index d468a7f..9107ac7 100644 --- a/project/customer/views/bank_accounts_ajax.py +++ b/project/customer/views/bank_accounts_ajax.py @@ -11,9 +11,11 @@ from django.core.urlresolvers import reverse from project.commons.utils import dthandler from .. import models, forms +from ..decorators import license_required @login_required +@license_required def bank_accounts_list_ajax(request): """Список расчетных счетов пользователя - AJAX.""" if not request.is_ajax(): @@ -31,6 +33,7 @@ def bank_accounts_list_ajax(request): @login_required +@license_required def bank_accounts_get_ajax(request, id): """Получить счёт - AJAX. Если в форме редактирования счёта задан атрибут Meta.fields, то дампит только поля, перечисленные в нём. @@ -51,6 +54,7 @@ def bank_accounts_get_ajax(request, id): @login_required +@license_required @require_POST @csrf_protect def bank_accounts_add_ajax(request): @@ -79,6 +83,7 @@ def bank_accounts_add_ajax(request): @login_required +@license_required @require_POST @csrf_protect def bank_accounts_edit_ajax(request, id): @@ -107,6 +112,7 @@ def bank_accounts_edit_ajax(request, id): @login_required +@license_required @require_POST @csrf_protect def bank_accounts_delete_ajax(request, id): diff --git a/project/customer/views/clients.py b/project/customer/views/clients.py index bd3d65b..39fa776 100644 --- a/project/customer/views/clients.py +++ b/project/customer/views/clients.py @@ -6,9 +6,11 @@ from django.contrib.auth.decorators import login_required from project.commons.paginator import pagination, save_per_page_value from .. import models, forms +from ..decorators import license_required @login_required +@license_required @csrf_protect @save_per_page_value def clients_list(request, page_num=None): @@ -29,6 +31,7 @@ def clients_list(request, page_num=None): @login_required +@license_required @csrf_protect def clients_add(request): """Добавить контрагента.""" @@ -53,6 +56,7 @@ def clients_add(request): @login_required +@license_required @csrf_protect def clients_edit(request, id): """Редактировать контрагента.""" @@ -82,6 +86,7 @@ def clients_edit(request, id): @login_required +@license_required @csrf_protect def clients_delete(request, id): """Удалить контрагента.""" diff --git a/project/customer/views/clients_ajax.py b/project/customer/views/clients_ajax.py index 68478b2..b4c07d2 100644 --- a/project/customer/views/clients_ajax.py +++ b/project/customer/views/clients_ajax.py @@ -8,9 +8,11 @@ from django.views.decorators.csrf import csrf_protect from django.contrib.auth.decorators import login_required from .. import models, forms +from ..decorators import license_required @login_required +@license_required def clients_get_ajax(request, id): """Получить контрагента - AJAX. Если в форме редактирования контрагента задан атрибут Meta.fields, то дампит только поля, перечисленные в нём. @@ -30,6 +32,7 @@ def clients_get_ajax(request, id): @login_required +@license_required @require_POST @csrf_protect def clients_add_ajax(request): @@ -66,6 +69,7 @@ def clients_add_ajax(request): @login_required +@license_required @require_POST @csrf_protect def clients_edit_ajax(request, id): @@ -95,6 +99,7 @@ def clients_edit_ajax(request, id): @login_required +@license_required @require_POST @csrf_protect def clients_delete_ajax(request, id): diff --git a/project/customer/views/license.py b/project/customer/views/license.py index 3004270..638c729 100644 --- a/project/customer/views/license.py +++ b/project/customer/views/license.py @@ -19,6 +19,34 @@ def order_license(request): dictionary = { '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) +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) diff --git a/project/customer/views/profile.py b/project/customer/views/profile.py index ff8f391..ca12438 100644 --- a/project/customer/views/profile.py +++ b/project/customer/views/profile.py @@ -12,6 +12,7 @@ from django.conf import settings from project.commons.pdf_tools import render_pdf_to_string, pdf_to_response from .. import models, forms +from ..decorators import license_required PDF_PROFILE_NAME = u'Реквизиты.pdf' @@ -20,6 +21,7 @@ SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '') # ----------------------------------------------------------------------------- +@license_required @login_required @csrf_protect def profile_view(request): @@ -57,6 +59,7 @@ def profile_view(request): @login_required +@license_required @csrf_protect def profile_edit(request): """Редактировать профиль пользователя.""" @@ -90,6 +93,7 @@ def profile_edit(request): @login_required +@license_required def _profile_get_pdf(request, profile=None, account=None, filters=None): """Создать профиль пользователя в PDF и вернуть как строку.""" template_name = 'customer/profile/as_pdf.html' @@ -102,6 +106,7 @@ def _profile_get_pdf(request, profile=None, account=None, filters=None): @login_required +@license_required def profile_as_pdf(request, profile=None, account=None, filters=None): """Вывести профиль пользователя в формате PDF в HttpResponse.""" pdf = _profile_get_pdf(request, profile, account, filters) @@ -122,6 +127,7 @@ def _send_profile_email(subject, to, body, pdf_content): return email.send() +@login_required @login_required @csrf_protect def profile_email(request): diff --git a/project/customer/views/profile_ajax.py b/project/customer/views/profile_ajax.py index 7ba0424..09084a0 100644 --- a/project/customer/views/profile_ajax.py +++ b/project/customer/views/profile_ajax.py @@ -9,10 +9,12 @@ from django.contrib.auth.decorators import login_required from .. import models, forms +from ..decorators import license_required from .profile import _send_profile_email, _profile_get_pdf @login_required +@license_required @require_POST @csrf_protect def profile_filters_edit_ajax(request): @@ -43,6 +45,7 @@ def profile_filters_edit_ajax(request): @login_required +@license_required @require_POST @csrf_protect def profile_email_ajax(request): diff --git a/project/docs/views/base_views.py b/project/docs/views/base_views.py index 129126d..629e416 100644 --- a/project/docs/views/base_views.py +++ b/project/docs/views/base_views.py @@ -28,6 +28,8 @@ from ..as_xls import render_xls_to_string from ..forms import EmailForm, InvoicesListForm from .. import filters +from project.customer.decorators import license_required + DEBUG = getattr(settings, 'DEBUG', False) SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '') @@ -182,6 +184,7 @@ class BaseViews(object): dictionary['clients_form'] = ClientsListForm(self.request.user) dictionary['invoices_form'] = InvoicesListForm(self.request.user) + @method_decorator(license_required) @method_decorator(csrf_protect) @method_decorator(save_per_page_value) def list(self, *args, **kwargs): @@ -229,6 +232,7 @@ class BaseViews(object): initial['doc_num'] = doc_num + 1 return initial + @method_decorator(license_required) @method_decorator(csrf_protect) def add(self, *args, **kwargs): """Добавить документ. @@ -277,6 +281,7 @@ class BaseViews(object): kwargs['initial'].pop('updated_at', None) return self.add(self.request, *args, **kwargs) + @method_decorator(license_required) @method_decorator(csrf_protect) def edit(self, *args, **kwargs): """Редактировать документ.""" @@ -306,6 +311,7 @@ class BaseViews(object): } return render(self.request, self.TEMPLATE_EDIT, dictionary) + @method_decorator(license_required) @method_decorator(csrf_protect) def delete(self, *args, **kwargs): """Удалить документ.""" @@ -434,6 +440,7 @@ class BaseViews(object): ) return False # что-то пошло не так + @method_decorator(license_required) @method_decorator(csrf_protect) def email(self, *args, **kwargs): """Отправить документ на email аттачем в заданном формате.""" @@ -548,6 +555,7 @@ class BaseItemsViews(BaseViews): """Обновить родительскую модель.""" pass + @method_decorator(license_required) @method_decorator(csrf_protect) def add(self, *args, **kwargs): """Добавить документ. @@ -643,6 +651,7 @@ class BaseItemsViews(BaseViews): return self.add(self.request, *args, **kwargs) + @method_decorator(license_required) @method_decorator(csrf_protect) def edit(self, *args, **kwargs): """Редактировать документ.""" diff --git a/project/static/css/style.css b/project/static/css/style.css index 4368522..b5e1bd9 100644 --- a/project/static/css/style.css +++ b/project/static/css/style.css @@ -203,3 +203,5 @@ table.list td { word-break: break-all; padding: 5px 0; } /* blockUI */ 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; } +.w100 {width:100px;} +.w200 {width:200px;} diff --git a/project/templates/customer/index.html b/project/templates/customer/index.html index b1f8ee3..17bad2f 100644 --- a/project/templates/customer/index.html +++ b/project/templates/customer/index.html @@ -8,6 +8,7 @@ Реквизиты

Расчётные счета

Контрагенты

+ Лицензии

diff --git a/project/templates/customer/profile/license.html b/project/templates/customer/profile/license.html index d2fdaa9..6ff043b 100644 --- a/project/templates/customer/profile/license.html +++ b/project/templates/customer/profile/license.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - +{% load pytils_numeral %} {% block title %}Купить лицензию{% endblock %} {% block content %} diff --git a/project/templates/customer/profile/license_list.html b/project/templates/customer/profile/license_list.html new file mode 100644 index 0000000..242cf6e --- /dev/null +++ b/project/templates/customer/profile/license_list.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load pytils_numeral %} +{% block title %}Купить лицензию{% endblock %} + +{% block content %} +{% for license in licenses %} +
+
{{ license.id }}
+
{{ license.order_date }}
+
{{ license.term }}
+
{{ license.get_payform_display }}
+
{{ license.get_status_display }}
+
{{ license.get_action }}
+
+
+{% endfor %} +{% endblock %} diff --git a/project/templates/customer/profile/paid_list.html b/project/templates/customer/profile/paid_list.html new file mode 100644 index 0000000..5027330 --- /dev/null +++ b/project/templates/customer/profile/paid_list.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load pytils_numeral %} +{% block title %}Купить лицензию{% endblock %} + +{% block content %} +{% for license in licenses %} +
+
{{ license.paid_date }}
+
{{ license.id }}
+
{{ license.pay_sum }}
+
{{ license.term }}
+
{{ license.date_from }} - {{ license.date_to }}
+
{{ license.get_status_display }}
+
+
+{% endfor %} +{% endblock %}