2018-03-19 06:11:04 -04:00
|
|
|
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"
|
2018-03-19 06:11:04 -04:00
|
|
|
CHOICES = (
|
2023-08-10 02:52:37 -04:00
|
|
|
(PENDING, "pending"),
|
|
|
|
(VALID, "valid"),
|
|
|
|
(INVALID, "invalid"),
|
|
|
|
(DELETED, "deleted"),
|
2018-03-19 06:11:04 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
2018-03-19 06:11:04 -04:00
|
|
|
|
|
|
|
class Meta:
|
2023-08-10 02:52:37 -04:00
|
|
|
default_related_name = "mentions"
|
|
|
|
unique_together = ("source", "target")
|