2๐
You can inherit the Plan
models and add your own attributes:
from pinax-stripe.models import Plan
class MyPlan(Plan):
# add your attributes
pass
This works like normal inheritance in python, plus your custom attributes are migrated when you run a migration because the original pinax Plan
is a subclass of models.Model
.
However, be careful to not use attribute names that already exist in the pinax Plan
model, since your new model will automatically take all the attibutes from Plan
and Django cannot write migrations for duplicate fields.
1๐
You can simply subclass Plan
and add whatever fields / methods you want:
from pinax-stripe.models import Plan
class UserProfile(Plan):
#write the extra fields here
- [Django]-Django Cache: Use Memcached and fallback to FileSystem
- [Django]-Django-admin action in 1.1
- [Django]-How do i convert WMD markdown syntax to HTML on my site?
- [Django]-Django urls from models
0๐
Iโd recommend you, use the OneToOne
relationship like Django docs recommend to use in the User model
from pinax-stripe.models import Plan
class UserProfile(models.Model):
plan = models.OneToOneField(Plan , on_delete=models.CASCADE)
#write the extra fields here
- [Django]-Broken Pipe in Django dev server โ What does this actually mean?
- [Django]-Django OneToOne Reverse Relation DoesNotExists when empty
- [Django]-Django โ link to url from different app in same project
- [Django]-Django + Apache deployment on Ubuntu
- [Django]-Django models: Reference field return multiple type of models
0๐
You can download pinax folder from https://github.com/pinax/pinax-stripe into your app and edit models.py and admin.py files as per your requirement.