20 lines
703 B
Python
20 lines
703 B
Python
from django.db import models
|
|
from apps.gooyal_oauth2.models import Application
|
|
from apps.users.models import User
|
|
|
|
|
|
class Plan(models.Model):
|
|
application = models.ForeignKey(Application, on_delete=models.PROTECT)
|
|
client_id = models.CharField(max_length=255, null=True, blank=True)
|
|
owner = models.ForeignKey(User, on_delete=models.PROTECT)
|
|
record_count = models.IntegerField(default=0)
|
|
record_limit = models.IntegerField(default=0)
|
|
|
|
|
|
class Data(models.Model):
|
|
user = models.ForeignKey(User, on_delete=models.PROTECT)
|
|
plan = models.ForeignKey(Plan, on_delete=models.PROTECT)
|
|
data = models.JSONField(default=dict)
|
|
|
|
class Meta:
|
|
unique_together = ('user', 'plan')
|