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 -*-
|
||||
# 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 django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import utils.mixins
|
||||
|
@ -11,7 +10,7 @@ import utils.mixins
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('membership', '0006_auto_20160526_0445'),
|
||||
('hosting', '0043_vmdetail'),
|
||||
]
|
||||
|
||||
|
@ -20,11 +19,13 @@ class Migration(migrations.Migration):
|
|||
name='UserCardDetail',
|
||||
fields=[
|
||||
('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)),
|
||||
('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)),
|
||||
('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={
|
||||
'permissions': (('view_usercarddetail', 'View User Card'),),
|
||||
|
|
|
@ -185,10 +185,12 @@ class VMDetail(models.Model):
|
|||
|
||||
class UserCardDetail(AssignPermissionsMixin, models.Model):
|
||||
permissions = ('view_usercarddetail',)
|
||||
user = models.ForeignKey(CustomUser)
|
||||
stripe_customer_id = models.CharField(unique=True, max_length=100)
|
||||
user = models.ForeignKey(StripeCustomer)
|
||||
last4 = models.CharField(max_length=4)
|
||||
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)
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in a new issue