Commit 5b2b5230 by Cole Rogers

Addressed PR feedback

parent 4f47ea74
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-06 00:29 # Generated by Django 1.11.11 on 2018-07-06 14:21
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields import django_extensions.db.fields
import sortedm2m.fields import sortedm2m.fields
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
...@@ -20,14 +20,15 @@ class Migration(migrations.Migration): ...@@ -20,14 +20,15 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')), ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')), ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('name', models.CharField(max_length=255)), ('name', models.CharField(max_length=255, unique=True)),
('org_name', models.CharField(max_length=255, verbose_name='Organization name')), ('org_name', models.CharField(max_length=255, verbose_name='Organization name')),
('email', models.EmailField(max_length=255)), ('email', models.EmailField(max_length=254)),
('programs', sortedm2m.fields.SortedManyToManyField(help_text=None, to='course_metadata.Program')), ('programs', sortedm2m.fields.SortedManyToManyField(help_text=None, to='course_metadata.Program')),
], ],
), options={
migrations.AlterUniqueTogether( 'get_latest_by': 'modified',
name='creditpathway', 'abstract': False,
unique_together=set([('name', 'org_name')]), 'ordering': ('-modified', '-created'),
},
), ),
] ]
...@@ -1276,16 +1276,15 @@ class Program(TimeStampedModel): ...@@ -1276,16 +1276,15 @@ class Program(TimeStampedModel):
class CreditPathway(TimeStampedModel): class CreditPathway(TimeStampedModel):
""" Credit Pathway model """ """ Credit Pathway model """
name = models.CharField(max_length=255) name = models.CharField(max_length=255, unique=True)
# this field doesn't necessarily map to our normal org models, it's just a convenience field for pathways
# while we figure them out
org_name = models.CharField(max_length=255, verbose_name=_("Organization name")) org_name = models.CharField(max_length=255, verbose_name=_("Organization name"))
email = models.EmailField(max_length=255) email = models.EmailField()
programs = SortedManyToManyField(Program) programs = SortedManyToManyField(Program)
def __str__(self): def __str__(self):
return "{org_name}: {name}".format(org_name=self.org_name, name=self.name) return self.name
class Meta(object):
unique_together = ('name', 'org_name')
class PersonSocialNetwork(AbstractSocialNetworkModel): class PersonSocialNetwork(AbstractSocialNetworkModel):
......
...@@ -1115,8 +1115,7 @@ class CreditPathwayTests(TestCase): ...@@ -1115,8 +1115,7 @@ class CreditPathwayTests(TestCase):
def test_str(self): def test_str(self):
credit_pathway = factories.CreditPathwayFactory() credit_pathway = factories.CreditPathwayFactory()
self.assertEqual(str(credit_pathway), self.assertEqual(str(credit_pathway), credit_pathway.name)
'{org_name}: {name}'.format(org_name=credit_pathway.org_name, name=credit_pathway.name))
class PersonSocialNetworkTests(TestCase): class PersonSocialNetworkTests(TestCase):
......
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