Skip to content
Snippets Groups Projects
Commit 49e09475 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Explicitly create 'lvem' and 'public' tags

parent 91618857
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-28 14:21:20
from __future__ import unicode_literals
from django.db import migrations
# Create Tag instances for current list of "blessed" tags.
# Based on current list in settings (26 Oct 2017)
# List of tag names and display names
TAGS = [
{'name': 'lvem', 'displayName': 'LV-EM'},
{'name': 'public', 'displayName': 'Public'},
]
def add_tags(apps, schema_editor):
Tag = apps.get_model('events', 'Tag')
# Create tags
for tag_dict in TAGS:
tag, created = Tag.objects.get_or_create(name=tag_dict['name'])
tag.displayName = tag_dict['displayName']
tag.save()
# Note there is no reverse migration since we don't want to remove these tags,
# because they existed already, at least in production.
class Migration(migrations.Migration):
dependencies = [
('events', '0024_add_labels'),
]
operations = [
migrations.RunPython(add_tags, migrations.RunPython.noop),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment