takahe/users/models/user_event.py

23 lines
559 B
Python
Raw Permalink Normal View History

2022-11-05 13:17:27 -07:00
from django.db import models
class UserEvent(models.Model):
"""
Tracks major events that happen to users
"""
class EventType(models.TextChoices):
created = "created"
reset_password = "reset_password"
banned = "banned"
user = models.ForeignKey(
"users.User",
on_delete=models.CASCADE,
related_name="events",
)
date = models.DateTimeField(auto_now_add=True)
type = models.CharField(max_length=100, choices=EventType.choices)
data = models.JSONField(blank=True, null=True)