lemoncurry/webmention/models.py

28 lines
721 B
Python
Raw Permalink Normal View History

from django.db import models
from entries.models import Entry
from model_utils.models import TimeStampedModel
class State:
2023-08-10 02:52:37 -04:00
PENDING = "p"
VALID = "v"
INVALID = "i"
DELETED = "d"
CHOICES = (
2023-08-10 02:52:37 -04:00
(PENDING, "pending"),
(VALID, "valid"),
(INVALID, "invalid"),
(DELETED, "deleted"),
)
class Webmention(TimeStampedModel):
entry = models.ForeignKey(Entry, on_delete=models.CASCADE)
source = models.CharField(max_length=255)
target = models.CharField(max_length=255)
2023-08-10 02:52:37 -04:00
state = models.CharField(choices=State.CHOICES, default=State.PENDING, max_length=1)
class Meta:
2023-08-10 02:52:37 -04:00
default_related_name = "mentions"
unique_together = ("source", "target")