17 lines
507 B
Python
17 lines
507 B
Python
from django.db import models
|
|
|
|
from core.apps.shared.models import BaseModel
|
|
from core.apps.accounts.models import User
|
|
|
|
|
|
class Notification(BaseModel):
|
|
type = models.CharField(
|
|
choices=[('web', 'web'), ('mobile', 'mobile')],
|
|
max_length=6,
|
|
default='mobile'
|
|
)
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='notifications')
|
|
token = models.CharField(max_length=255, unique=True)
|
|
|
|
class Meta:
|
|
unique_together = ('type', 'user', 'token') |