diff options
| -rw-r--r-- | api/migrations/0006_tag.py | 25 | ||||
| -rw-r--r-- | api/models.py | 27 | 
2 files changed, 52 insertions, 0 deletions
| diff --git a/api/migrations/0006_tag.py b/api/migrations/0006_tag.py new file mode 100644 index 00000000..903f334e --- /dev/null +++ b/api/migrations/0006_tag.py @@ -0,0 +1,25 @@ +# Generated by Django 2.1.1 on 2018-09-01 21:20 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('api', '0005_user'), +    ] + +    operations = [ +        migrations.CreateModel( +            name='Tag', +            fields=[ +                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), +                ('title', models.CharField(help_text='The title of this tag, displayed in the Embed.', max_length=256, unique=True)), +                ('content', models.CharField(help_text='The content of this tag, displayed in the Embed.', max_length=2048)), +                ('image_url', models.URLField(help_text='An optional image to display in the tag embed.', null=True)), +                ('thumbnail_url', models.URLField(help_text='An optional thumbnail to display in the tag embed.', null=True)), +                ('author', models.ForeignKey(help_text='The user that originally created this tag.', on_delete=django.db.models.deletion.CASCADE, to='api.Member')), +            ], +        ), +    ] diff --git a/api/models.py b/api/models.py index 5d7dfc35..4e4de9e0 100644 --- a/api/models.py +++ b/api/models.py @@ -104,3 +104,30 @@ class Member(models.Model):          Role,          help_text="Any roles this user has on our server."      ) + + +class Tag(models.Model): +    """A tag providing (hopefully) useful content, shown by the bot.""" + +    author = models.ForeignKey( +        Member, +        help_text="The user that originally created this tag.", +        on_delete=models.CASCADE +    ) +    title = models.CharField( +        max_length=256, +        help_text="The title of this tag, displayed in the Embed.", +        unique=True +    ) +    content = models.CharField( +        max_length=2048, +        help_text="The content of this tag, displayed in the Embed." +    ) +    image_url = models.URLField( +        null=True, +        help_text="An optional image to display in the tag embed." +    ) +    thumbnail_url = models.URLField( +        null=True, +        help_text="An optional thumbnail to display in the tag embed." +    ) | 
