This repository has been archived on 2023-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
takahe/users/models/user_event.py

23 lines
559 B
Python
Raw Normal View History

2022-11-05 21:17:27 +01: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)