31 lines
916 B
Python
Executable File
31 lines
916 B
Python
Executable File
from django.db import models
|
|
from at_django_boilerplate.utils.mixins import HashidSlugMixin,UUIDMixin
|
|
|
|
class Subscriber(UUIDMixin):
|
|
email = models.EmailField(unique=True)
|
|
subscribed_at = models.DateTimeField(auto_now_add=True)
|
|
is_active = models.BooleanField(default=True)
|
|
|
|
class Meta:
|
|
ordering = ['-subscribed_at'] # latest first
|
|
verbose_name = "Subscriber"
|
|
verbose_name_plural = "Subscribers"
|
|
|
|
def __str__(self):
|
|
return f"{self.email} (joined {self.subscribed_at.strftime('%Y-%m-%d %H:%M')})"
|
|
|
|
|
|
|
|
|
|
class ABTestRecord(UUIDMixin):
|
|
session_key = models.CharField(max_length=255, unique=True)
|
|
variant = models.CharField(max_length=1, choices=[('A', 'index.html'), ('B', 'index2.html')])
|
|
timestamp = models.DateTimeField(auto_now_add=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.session_key} -> {self.variant}"
|
|
|
|
from django.db import models
|
|
|
|
|