kopia lustrzana https://github.com/jointakahe/takahe
Add HashtagFollow model and migration
rodzic
cedcc8fa7c
commit
cf0636fbd7
|
@ -0,0 +1,49 @@
|
|||
# Generated by Django 4.1.7 on 2023-03-11 19:50
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("activities", "0012_in_reply_to_index"),
|
||||
("users", "0015_bookmark"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="HashtagFollow",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created", models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
"hashtag",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="followers",
|
||||
to="activities.hashtag",
|
||||
),
|
||||
),
|
||||
(
|
||||
"identity",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="hashtag_follows",
|
||||
to="users.identity",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"unique_together": {("identity", "hashtag")},
|
||||
},
|
||||
),
|
||||
]
|
|
@ -3,6 +3,7 @@ from .block import Block, BlockStates # noqa
|
|||
from .bookmark import Bookmark # noqa
|
||||
from .domain import Domain # noqa
|
||||
from .follow import Follow, FollowStates # noqa
|
||||
from .hashtag_follow import HashtagFollow # noqa
|
||||
from .identity import Identity, IdentityStates # noqa
|
||||
from .inbox_message import InboxMessage, InboxMessageStates # noqa
|
||||
from .invite import Invite # noqa
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
from django.db import models
|
||||
|
||||
|
||||
class HashtagFollow(models.Model):
|
||||
identity = models.ForeignKey(
|
||||
"users.Identity",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="hashtag_follows",
|
||||
)
|
||||
hashtag = models.ForeignKey(
|
||||
"activities.Hashtag",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="followers",
|
||||
)
|
||||
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = [("identity", "hashtag")]
|
||||
|
||||
def __str__(self):
|
||||
return f"#{self.id}: {self.identity} → {self.hashtag_id}"
|
Ładowanie…
Reference in New Issue