FollowRequest model

merge-requests/154/head
Eliot Berriot 2018-04-04 19:38:28 +02:00
rodzic 3ad1fe17d5
commit b833a11fb6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 46 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,28 @@
# Generated by Django 2.0.3 on 2018-04-04 17:11
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
dependencies = [
('federation', '0003_auto_20180403_1921'),
]
operations = [
migrations.CreateModel(
name='FollowRequest',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, unique=True)),
('creation_date', models.DateTimeField(default=django.utils.timezone.now)),
('last_modification_date', models.DateTimeField(default=django.utils.timezone.now)),
('approved', models.NullBooleanField(default=None)),
('actor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='emmited_follow_requests', to='federation.Actor')),
('target', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='received_follow_requests', to='federation.Actor')),
],
),
]

Wyświetl plik

@ -103,3 +103,21 @@ class Follow(models.Model):
def get_federation_url(self):
return '{}#follows/{}'.format(self.actor.url, self.uuid)
class FollowRequest(models.Model):
uuid = models.UUIDField(default=uuid.uuid4, unique=True)
actor = models.ForeignKey(
Actor,
related_name='emmited_follow_requests',
on_delete=models.CASCADE,
)
target = models.ForeignKey(
Actor,
related_name='received_follow_requests',
on_delete=models.CASCADE,
)
creation_date = models.DateTimeField(default=timezone.now)
last_modification_date = models.DateTimeField(
default=timezone.now)
approved = models.NullBooleanField(default=None)