Relate UserCardDetail with StripeCustomer and add more fields to uniquely identify if a user already has a card
This commit is contained in:
		
					parent
					
						
							
								9a9a764023
							
						
					
				
			
			
				commit
				
					
						a1d7b07e0c
					
				
			
		
					 2 changed files with 10 additions and 7 deletions
				
			
		|  | @ -1,8 +1,7 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| # Generated by Django 1.9.4 on 2017-10-15 18:05 | # Generated by Django 1.9.4 on 2017-10-15 19:17 | ||||||
| from __future__ import unicode_literals | from __future__ import unicode_literals | ||||||
| 
 | 
 | ||||||
| from django.conf import settings |  | ||||||
| from django.db import migrations, models | from django.db import migrations, models | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
| import utils.mixins | import utils.mixins | ||||||
|  | @ -11,7 +10,7 @@ import utils.mixins | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
| 
 | 
 | ||||||
|     dependencies = [ |     dependencies = [ | ||||||
|         migrations.swappable_dependency(settings.AUTH_USER_MODEL), |         ('membership', '0006_auto_20160526_0445'), | ||||||
|         ('hosting', '0043_vmdetail'), |         ('hosting', '0043_vmdetail'), | ||||||
|     ] |     ] | ||||||
| 
 | 
 | ||||||
|  | @ -20,11 +19,13 @@ class Migration(migrations.Migration): | ||||||
|             name='UserCardDetail', |             name='UserCardDetail', | ||||||
|             fields=[ |             fields=[ | ||||||
|                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||||||
|                 ('stripe_customer_id', models.CharField(max_length=100, unique=True)), |  | ||||||
|                 ('last4', models.CharField(max_length=4)), |                 ('last4', models.CharField(max_length=4)), | ||||||
|                 ('brand', models.CharField(max_length=10)), |                 ('brand', models.CharField(max_length=10)), | ||||||
|  |                 ('fingerprint', models.CharField(max_length=100)), | ||||||
|  |                 ('exp_month', models.IntegerField()), | ||||||
|  |                 ('exp_year', models.IntegerField()), | ||||||
|                 ('preferred', models.BooleanField(default=False)), |                 ('preferred', models.BooleanField(default=False)), | ||||||
|                 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), |                 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.StripeCustomer')), | ||||||
|             ], |             ], | ||||||
|             options={ |             options={ | ||||||
|                 'permissions': (('view_usercarddetail', 'View User Card'),), |                 'permissions': (('view_usercarddetail', 'View User Card'),), | ||||||
|  |  | ||||||
|  | @ -185,10 +185,12 @@ class VMDetail(models.Model): | ||||||
| 
 | 
 | ||||||
| class UserCardDetail(AssignPermissionsMixin, models.Model): | class UserCardDetail(AssignPermissionsMixin, models.Model): | ||||||
|     permissions = ('view_usercarddetail',) |     permissions = ('view_usercarddetail',) | ||||||
|     user = models.ForeignKey(CustomUser) |     user = models.ForeignKey(StripeCustomer) | ||||||
|     stripe_customer_id = models.CharField(unique=True, max_length=100) |  | ||||||
|     last4 = models.CharField(max_length=4) |     last4 = models.CharField(max_length=4) | ||||||
|     brand = models.CharField(max_length=10) |     brand = models.CharField(max_length=10) | ||||||
|  |     fingerprint = models.CharField(max_length=100) | ||||||
|  |     exp_month = models.IntegerField(null=False) | ||||||
|  |     exp_year = models.IntegerField(null=False) | ||||||
|     preferred = models.BooleanField(default=False) |     preferred = models.BooleanField(default=False) | ||||||
| 
 | 
 | ||||||
|     class Meta: |     class Meta: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue