mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 12:19:15 +02:00
Added follow model and factory
This commit is contained in:
parent
6aa6f1d8f8
commit
f19418d2c2
7 changed files with 99 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
@ -74,3 +76,23 @@ class Actor(models.Model):
|
|||
from . import actors
|
||||
if self.is_system:
|
||||
return actors.SYSTEM_ACTORS[self.preferred_username]
|
||||
|
||||
|
||||
class Follow(models.Model):
|
||||
uuid = models.UUIDField(default=uuid.uuid4, unique=True)
|
||||
actor = models.ForeignKey(
|
||||
Actor,
|
||||
related_name='emitted_follows',
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
target = models.ForeignKey(
|
||||
Actor,
|
||||
related_name='received_follows',
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
creation_date = models.DateTimeField(default=timezone.now)
|
||||
last_modification_date = models.DateTimeField(
|
||||
default=timezone.now)
|
||||
|
||||
class Meta:
|
||||
unique_together = ['actor', 'target']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue