edit tags to have display name and identifying url

This commit is contained in:
Invinceaman 2020-11-04 15:58:11 -05:00
parent 5d680462f4
commit 1342505783
2 changed files with 26 additions and 1 deletions
studyguides/apps/courses

View File

@ -0,0 +1,24 @@
# Generated by Django 3.1.2 on 2020-11-04 20:57
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0007_auto_20201027_1250'),
]
operations = [
migrations.AddField(
model_name='tag',
name='url',
field=models.SlugField(max_length=100, null=True, unique=True, validators=[django.core.validators.RegexValidator(message='Only lowercase alphanumeric, dashes, and underscores allowed', regex='^[a-z0-9_\\-]+$')]),
),
migrations.AlterField(
model_name='tag',
name='name',
field=models.CharField(max_length=100, unique=True),
),
]

View File

@ -37,7 +37,8 @@ class Guide(models.Model):
class Tag(models.Model):
id = models.AutoField(primary_key=True)
name = models.SlugField(max_length=100, unique=True, validators=[RegexValidator(
name = models.CharField(max_length=100, unique=True)
url = models.SlugField(max_length=100, unique=True, null=True, validators=[RegexValidator(
regex="^[a-z0-9_\-]+$", message="Only lowercase alphanumeric, dashes, and underscores allowed")])
def __str__(self):