Add UserCardDetail create method that assigns appropriate object permission
This commit is contained in:
parent
51039a5cb3
commit
255c8a1d80
1 changed files with 11 additions and 1 deletions
|
@ -196,4 +196,14 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
|
|||
class Meta:
|
||||
permissions = (
|
||||
('view_usercarddetail', 'View User Card'),
|
||||
)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create(cls, stripe_customer=None, last4=None, brand=None,
|
||||
fingerprint=None, exp_month=None, exp_year=None):
|
||||
instance = cls.objects.create(
|
||||
stripe_customer=stripe_customer, last4=last4, brand=brand,
|
||||
fingerprint=fingerprint, exp_month=exp_month, exp_year=exp_year
|
||||
)
|
||||
instance.assign_permissions(stripe_customer.user)
|
||||
return instance
|
||||
|
|
Loading…
Reference in a new issue