Skip to content

Commit

Permalink
Respond to review.
Browse files Browse the repository at this point in the history
  • Loading branch information
feanil committed Jun 5, 2019
1 parent 37b80b2 commit 8fff540
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 38 deletions.
3 changes: 1 addition & 2 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import os
import sys

Expand Down
3 changes: 1 addition & 2 deletions milestones/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""
Admin module for milestones app
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.contrib import admin

from milestones.models import (
Expand Down
3 changes: 1 addition & 2 deletions milestones/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
Note the terminology difference at this layer vs. Data -- add/edit/get/remove
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from . import data
from . import exceptions
from . import validators
Expand Down
3 changes: 1 addition & 2 deletions milestones/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
else:
import milestones.resources as remote
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals

import six

Expand Down
3 changes: 1 addition & 2 deletions milestones/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""
Application-specific exception classes used throughout the implementation
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.core.exceptions import ValidationError


Expand Down
29 changes: 17 additions & 12 deletions milestones/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
which leverages Django's signal framework.
"""

from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from model_utils.models import TimeStampedModel


@python_2_unicode_compatible
class Milestone(TimeStampedModel):
"""
A Milestone is a representation of an accomplishment which can be
Expand All @@ -33,10 +34,11 @@ class Meta:
""" Meta class for this Django model """
unique_together = (("namespace", "name"),)

def __unicode__(self):
return str(self.namespace)
def __str__(self):
return self.namespace


@python_2_unicode_compatible
class MilestoneRelationshipType(TimeStampedModel):
"""
A MilestoneRelationshipType represents a category of link available
Expand All @@ -62,8 +64,8 @@ class MilestoneRelationshipType(TimeStampedModel):
description = models.TextField(blank=True)
active = models.BooleanField(default=True)

def __unicode__(self):
return str(self.name)
def __str__(self):
return self.name

@classmethod
# pylint: disable=invalid-name
Expand All @@ -76,6 +78,7 @@ def get_supported_milestone_relationship_types(cls):
return RELATIONSHIP_TYPE_CHOICES


@python_2_unicode_compatible
class CourseMilestone(TimeStampedModel):
"""
A CourseMilestone represents the link between a Course and a
Expand All @@ -95,10 +98,11 @@ class Meta:
""" Meta class for this Django model """
unique_together = (("course_id", "milestone"),)

def __unicode__(self):
return str("%s:%s:%s" % (self.course_id, self.milestone_relationship_type, self.milestone))
def __str__(self):
return "%s:%s:%s" % (self.course_id, self.milestone_relationship_type, self.milestone)


@python_2_unicode_compatible
class CourseContentMilestone(TimeStampedModel):
"""
A CourseContentMilestone represents the link between a specific
Expand Down Expand Up @@ -126,10 +130,11 @@ class Meta:
""" Meta class for this Django model """
unique_together = (("course_id", "content_id", "milestone"),)

def __unicode__(self):
return str("%s:%s:%s" % (self.content_id, self.milestone_relationship_type, self.milestone))
def __str__(self):
return "%s:%s:%s" % (self.content_id, self.milestone_relationship_type, self.milestone)


@python_2_unicode_compatible
class UserMilestone(TimeStampedModel):
"""
A UserMilestone represents an stage reached or event experienced
Expand All @@ -155,5 +160,5 @@ class Meta:
""" Meta class for this Django model """
unique_together = ("user_id", "milestone")

def __unicode__(self):
return str("%s:%s" % (self.user_id, self.milestone))
def __str__(self):
return "%s:%s" % (self.user_id, self.milestone)
3 changes: 1 addition & 2 deletions milestones/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
Data layer serialization operations. Converts querysets to simple
python containers (mainly arrays and dicts).
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import json

from . import models
Expand Down
3 changes: 1 addition & 2 deletions milestones/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
A wrapper class around requested methods exposed in api.py
"""

from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import types

from milestones import api as milestones_api
Expand Down
3 changes: 1 addition & 2 deletions milestones/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"""
Milestones API Module Test Cases
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals

from opaque_keys.edx.keys import UsageKey

Expand Down
3 changes: 1 addition & 2 deletions milestones/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
Note: 'Unit Test: ' labels are output to the console during test runs
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import milestones.api as api
import milestones.data as data
import milestones.exceptions as exceptions
Expand Down
3 changes: 1 addition & 2 deletions milestones/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
Test for the xBlock service
"""

from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import unittest
import types

Expand Down
3 changes: 1 addition & 2 deletions milestones/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"""
Utility module for Milestones test cases
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
from opaque_keys.edx.keys import CourseKey, UsageKey
Expand Down
3 changes: 1 addition & 2 deletions milestones/validators.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""
Validators confirm the integrity of inbound information prior to a data.py handoff
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals

import json
import six
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python

from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from setuptools import setup, find_packages
from milestones import __version__ as VERSION

Expand Down

0 comments on commit 8fff540

Please sign in to comment.