Commit d63216f8 by Kevin Falcone

Merge pull request #21 from edx/jibsheet/dont-use-using

Jibsheet/dont use using
parents 50ad9b5f b655c98f
...@@ -9,9 +9,8 @@ from milestones.data import fetch_milestone_relationship_types ...@@ -9,9 +9,8 @@ from milestones.data import fetch_milestone_relationship_types
def seed_relationship_types(apps, schema_editor): def seed_relationship_types(apps, schema_editor):
"""Seed the relationship types.""" """Seed the relationship types."""
MilestoneRelationshipType = apps.get_model("milestones", "MilestoneRelationshipType") MilestoneRelationshipType = apps.get_model("milestones", "MilestoneRelationshipType")
db_alias = schema_editor.connection.alias
for name in fetch_milestone_relationship_types().values(): for name in fetch_milestone_relationship_types().values():
MilestoneRelationshipType.objects.using(db_alias).get_or_create( MilestoneRelationshipType.objects.get_or_create(
name=name, name=name,
description='Autogenerated milestone relationship type "{}"'.format(name), description='Autogenerated milestone relationship type "{}"'.format(name),
) )
...@@ -20,9 +19,8 @@ def seed_relationship_types(apps, schema_editor): ...@@ -20,9 +19,8 @@ def seed_relationship_types(apps, schema_editor):
def delete_relationship_types(apps, schema_editor): def delete_relationship_types(apps, schema_editor):
"""Clean up any relationships we made.""" """Clean up any relationships we made."""
MilestoneRelationshipType = apps.get_model("milestones", "MilestoneRelationshipType") MilestoneRelationshipType = apps.get_model("milestones", "MilestoneRelationshipType")
db_alias = schema_editor.connection.alias
for name in fetch_milestone_relationship_types().values(): for name in fetch_milestone_relationship_types().values():
MilestoneRelationshipType.objects.using(db_alias).filter(name=name).delete() MilestoneRelationshipType.objects.filter(name=name).delete()
class Migration(migrations.Migration): class Migration(migrations.Migration):
......
...@@ -4,7 +4,7 @@ from setuptools import setup, find_packages ...@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
setup( setup(
name='edx-milestones', name='edx-milestones',
version='0.1.7', version='0.1.8',
description='Significant events module for Open edX', description='Significant events module for Open edX',
long_description=open('README.md').read(), long_description=open('README.md').read(),
author='edX', author='edX',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment