diff options
| -rw-r--r-- | api/migrations/0007_tag.py | 23 | ||||
| -rw-r--r-- | api/models.py | 17 | 
2 files changed, 40 insertions, 0 deletions
| diff --git a/api/migrations/0007_tag.py b/api/migrations/0007_tag.py new file mode 100644 index 00000000..fdb3b9cc --- /dev/null +++ b/api/migrations/0007_tag.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.1 on 2018-09-21 22:05 + +import api.models +import django.contrib.postgres.fields.jsonb +from django.db import migrations, models + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('api', '0006_add_help_texts'), +    ] + +    operations = [ +        migrations.CreateModel( +            name='Tag', +            fields=[ +                ('title', models.CharField(help_text='The title of this tag, shown in searches and providing a quick overview over what this embed contains.', max_length=100, primary_key=True, serialize=False)), +                ('embed', django.contrib.postgres.fields.jsonb.JSONField(help_text='The actual embed shown by this tag.')), +            ], +            bases=(api.models.ModelReprMixin, models.Model), +        ), +    ] diff --git a/api/models.py b/api/models.py index 6b681ebc..58668c34 100644 --- a/api/models.py +++ b/api/models.py @@ -1,5 +1,6 @@  from operator import itemgetter +from django.contrib.postgres import fields as pgfields  from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator  from django.db import models @@ -159,3 +160,19 @@ class Member(ModelReprMixin, models.Model):      def __str__(self):          return f"{self.name}#{self.discriminator}" + + +class Tag(ModelReprMixin, models.Model): +    """A tag providing (hopefully) useful information.""" + +    title = models.CharField( +        max_length=100, +        help_text=( +            "The title of this tag, shown in searches and providing " +            "a quick overview over what this embed contains." +        ), +        primary_key=True +    ) +    embed = pgfields.JSONField( +        help_text="The actual embed shown by this tag." +    ) | 
