Skip to content

Instantly share code, notes, and snippets.

@MainaKamau92
Last active August 3, 2020 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MainaKamau92/18c23162f3b15f10b15d7e0508a982dc to your computer and use it in GitHub Desktop.
Save MainaKamau92/18c23162f3b15f10b15d7e0508a982dc to your computer and use it in GitHub Desktop.
import uuid
import os
from django.db import models
from tenant_schemas.models import TenantMixin
# Create your models here.
class Client(TenantMixin):
REQUIRED_FIELDS = ('tenant_name', 'paid_until', 'schema_name', 'on_trial')
tenant_name = models.CharField(max_length=100, unique=True, null=False, blank=False)
tenant_uuid = models.UUIDField(default=uuid.uuid4, null=False, blank=False)
paid_until = models.DateField()
on_trial = models.BooleanField()
created_on = models.DateField(auto_now_add=True)
domain_url = models.URLField(blank=True, null=True, default=os.getenv('DOMAIN'))
# default true, schema will be automatically created and synced when it is saved
auto_create_schema = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment