summaryrefslogtreecommitdiffstats
path: root/activities/migrations/0004_emoji_post_emojis.py
blob: 89bc8257f8f320ffbcfbf50214265573ab60b45c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Generated by Django 4.1.4 on 2022-12-14 23:49

import functools

import django.db.models.deletion
from django.db import migrations, models

import activities.models.emoji
import core.uploads
import stator.models


class Migration(migrations.Migration):

    dependencies = [
        ("users", "0003_identity_followers_etc"),
        ("activities", "0003_postattachment_null_thumb"),
    ]

    operations = [
        migrations.CreateModel(
            name="Emoji",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("state_ready", models.BooleanField(default=True)),
                ("state_changed", models.DateTimeField(auto_now_add=True)),
                ("state_attempted", models.DateTimeField(blank=True, null=True)),
                ("state_locked_until", models.DateTimeField(blank=True, null=True)),
                ("shortcode", models.SlugField(max_length=100)),
                ("local", models.BooleanField(default=True)),
                ("public", models.BooleanField(null=True)),
                (
                    "object_uri",
                    models.CharField(
                        blank=True, max_length=500, null=True, unique=True
                    ),
                ),
                ("mimetype", models.CharField(max_length=200)),
                (
                    "file",
                    models.ImageField(
                        blank=True,
                        null=True,
                        upload_to=functools.partial(
                            core.uploads.upload_emoji_namer, *("emoji",), **{}
                        ),
                    ),
                ),
                ("remote_url", models.CharField(blank=True, max_length=500, null=True)),
                ("category", models.CharField(blank=True, max_length=100, null=True)),
                (
                    "state",
                    stator.models.StateField(
                        choices=[("outdated", "outdated"), ("updated", "updated")],
                        default="outdated",
                        graph=activities.models.emoji.EmojiStates,
                        max_length=100,
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("updated", models.DateTimeField(auto_now=True)),
                (
                    "domain",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="users.domain",
                    ),
                ),
            ],
            options={
                "unique_together": {("domain", "shortcode")},
            },
        ),
        migrations.AddField(
            model_name="post",
            name="emojis",
            field=models.ManyToManyField(
                blank=True, related_name="posts_using_emoji", to="activities.emoji"
            ),
        ),
    ]