Commit 6294766c by John Eskew

Split emitted signals from the student models file.

parent 612c99ba
...@@ -10,8 +10,9 @@ import ddt ...@@ -10,8 +10,9 @@ import ddt
from shoppingcart.models import Order, CertificateItem # pylint: disable=import-error from shoppingcart.models import Order, CertificateItem # pylint: disable=import-error
from course_modes.models import CourseMode from course_modes.models import CourseMode
from student.management.commands import transfer_students from student.management.commands import transfer_students
from student.models import CourseEnrollment, UNENROLL_DONE, EVENT_NAME_ENROLLMENT_DEACTIVATED, \ from student.models import CourseEnrollment, EVENT_NAME_ENROLLMENT_DEACTIVATED, \
EVENT_NAME_ENROLLMENT_ACTIVATED, EVENT_NAME_ENROLLMENT_MODE_CHANGED EVENT_NAME_ENROLLMENT_ACTIVATED, EVENT_NAME_ENROLLMENT_MODE_CHANGED
from student.signals import UNENROLL_DONE
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
......
...@@ -31,7 +31,7 @@ from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist ...@@ -31,7 +31,7 @@ from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import IntegrityError, models from django.db import IntegrityError, models
from django.db.models import Count from django.db.models import Count
from django.db.models.signals import post_save, pre_save from django.db.models.signals import post_save, pre_save
from django.dispatch import Signal, receiver from django.dispatch import receiver
from django.utils import timezone from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -48,6 +48,7 @@ from slumber.exceptions import HttpClientError, HttpServerError ...@@ -48,6 +48,7 @@ from slumber.exceptions import HttpClientError, HttpServerError
import dogstats_wrapper as dog_stats_api import dogstats_wrapper as dog_stats_api
import lms.lib.comment_client as cc import lms.lib.comment_client as cc
import request_cache import request_cache
from student.signals import UNENROLL_DONE, ENROLL_STATUS_CHANGE, REFUND_ORDER, ENROLLMENT_TRACK_UPDATED
from certificates.models import GeneratedCertificate from certificates.models import GeneratedCertificate
from course_modes.models import CourseMode from course_modes.models import CourseMode
from courseware.models import DynamicUpgradeDeadlineConfiguration, CourseDynamicUpgradeDeadlineConfiguration from courseware.models import DynamicUpgradeDeadlineConfiguration, CourseDynamicUpgradeDeadlineConfiguration
...@@ -63,11 +64,6 @@ from util.milestones_helpers import is_entrance_exams_enabled ...@@ -63,11 +64,6 @@ from util.milestones_helpers import is_entrance_exams_enabled
from util.model_utils import emit_field_changed_events, get_changed_fields_dict from util.model_utils import emit_field_changed_events, get_changed_fields_dict
from util.query import use_read_replica_if_available from util.query import use_read_replica_if_available
from .signals.signals import ENROLLMENT_TRACK_UPDATED
UNENROLL_DONE = Signal(providing_args=["course_enrollment", "skip_refund"])
ENROLL_STATUS_CHANGE = Signal(providing_args=["event", "user", "course_id", "mode", "cost", "currency"])
REFUND_ORDER = Signal(providing_args=["course_enrollment"])
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
AUDIT_LOG = logging.getLogger("audit") AUDIT_LOG = logging.getLogger("audit")
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore # pylint: disable=invalid-name SessionStore = import_module(settings.SESSION_ENGINE).SessionStore # pylint: disable=invalid-name
......
from student.signals.signals import (
ENROLLMENT_TRACK_UPDATED,
UNENROLL_DONE,
ENROLL_STATUS_CHANGE,
REFUND_ORDER
)
...@@ -4,3 +4,6 @@ Enrollment track related signals. ...@@ -4,3 +4,6 @@ Enrollment track related signals.
from django.dispatch import Signal from django.dispatch import Signal
ENROLLMENT_TRACK_UPDATED = Signal(providing_args=['user', 'course_key']) ENROLLMENT_TRACK_UPDATED = Signal(providing_args=['user', 'course_key'])
UNENROLL_DONE = Signal(providing_args=["course_enrollment", "skip_refund"])
ENROLL_STATUS_CHANGE = Signal(providing_args=["event", "user", "course_id", "mode", "cost", "currency"])
REFUND_ORDER = Signal(providing_args=["course_enrollment"])
...@@ -20,7 +20,8 @@ from opaque_keys import InvalidKeyError ...@@ -20,7 +20,8 @@ from opaque_keys import InvalidKeyError
from milestones.tests.utils import MilestonesTestCaseMixin from milestones.tests.utils import MilestonesTestCaseMixin
from student.cookies import get_user_info_cookie_data from student.cookies import get_user_info_cookie_data
from student.helpers import DISABLE_UNENROLL_CERT_STATES from student.helpers import DISABLE_UNENROLL_CERT_STATES
from student.models import CourseEnrollment, REFUND_ORDER, UserProfile from student.models import CourseEnrollment, UserProfile
from student.signals import REFUND_ORDER
from student.tests.factories import CourseEnrollmentFactory, UserFactory from student.tests.factories import CourseEnrollmentFactory, UserFactory
from util.milestones_helpers import set_prerequisite_courses, remove_prerequisite_course, get_course_milestones from util.milestones_helpers import set_prerequisite_courses, remove_prerequisite_course, get_course_milestones
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
......
...@@ -118,9 +118,9 @@ from student.models import ( ...@@ -118,9 +118,9 @@ from student.models import (
UserStanding, UserStanding,
anonymous_id_for_user, anonymous_id_for_user,
create_comments_service_user, create_comments_service_user,
unique_id_for_user, unique_id_for_user
REFUND_ORDER
) )
from student.signals import REFUND_ORDER
from student.tasks import send_activation_email from student.tasks import send_activation_email
from third_party_auth import pipeline, provider from third_party_auth import pipeline, provider
from util.bad_request_rate_limiter import BadRequestRateLimiter from util.bad_request_rate_limiter import BadRequestRateLimiter
......
...@@ -5,7 +5,8 @@ from django.dispatch import receiver ...@@ -5,7 +5,8 @@ from django.dispatch import receiver
from lms.djangoapps.badges.events.course_meta import award_enrollment_badge from lms.djangoapps.badges.events.course_meta import award_enrollment_badge
from lms.djangoapps.badges.utils import badges_enabled from lms.djangoapps.badges.utils import badges_enabled
from student.models import ENROLL_STATUS_CHANGE, EnrollStatusChange from student.models import EnrollStatusChange
from student.signals import ENROLL_STATUS_CHANGE
@receiver(ENROLL_STATUS_CHANGE) @receiver(ENROLL_STATUS_CHANGE)
......
...@@ -19,7 +19,7 @@ from openedx.core.djangoapps.commerce.utils import ecommerce_api_client, is_comm ...@@ -19,7 +19,7 @@ from openedx.core.djangoapps.commerce.utils import ecommerce_api_client, is_comm
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming import helpers as theming_helpers from openedx.core.djangoapps.theming import helpers as theming_helpers
from request_cache.middleware import RequestCache from request_cache.middleware import RequestCache
from student.models import REFUND_ORDER from student.signals import REFUND_ORDER
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -23,7 +23,7 @@ from commerce.signals import create_zendesk_ticket, generate_refund_notification ...@@ -23,7 +23,7 @@ from commerce.signals import create_zendesk_ticket, generate_refund_notification
from commerce.tests import JSON from commerce.tests import JSON
from commerce.tests.mocks import mock_create_refund, mock_process_refund from commerce.tests.mocks import mock_create_refund, mock_process_refund
from course_modes.models import CourseMode from course_modes.models import CourseMode
from student.models import REFUND_ORDER from student.signals import REFUND_ORDER
from student.tests.factories import CourseEnrollmentFactory, UserFactory from student.tests.factories import CourseEnrollmentFactory, UserFactory
ZENDESK_URL = 'http://zendesk.example.com/' ZENDESK_URL = 'http://zendesk.example.com/'
......
...@@ -9,7 +9,7 @@ from django.dispatch import receiver ...@@ -9,7 +9,7 @@ from django.dispatch import receiver
from openedx.core.djangoapps.course_groups.signals.signals import COHORT_MEMBERSHIP_UPDATED from openedx.core.djangoapps.course_groups.signals.signals import COHORT_MEMBERSHIP_UPDATED
from openedx.core.lib.grade_utils import is_score_higher_or_equal from openedx.core.lib.grade_utils import is_score_higher_or_equal
from student.models import user_by_anonymous_id from student.models import user_by_anonymous_id
from student.signals.signals import ENROLLMENT_TRACK_UPDATED from student.signals import ENROLLMENT_TRACK_UPDATED
from submissions.models import score_reset, score_set from submissions.models import score_reset, score_set
from track.event_transaction_utils import get_event_transaction_id, get_event_transaction_type from track.event_transaction_utils import get_event_transaction_id, get_event_transaction_type
from util.date_utils import to_timestamp from util.date_utils import to_timestamp
......
...@@ -37,7 +37,8 @@ from eventtracking import tracker ...@@ -37,7 +37,8 @@ from eventtracking import tracker
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from shoppingcart.pdf import PDFInvoice from shoppingcart.pdf import PDFInvoice
from student.models import UNENROLL_DONE, CourseEnrollment, EnrollStatusChange from student.models import CourseEnrollment, EnrollStatusChange
from student.signals import UNENROLL_DONE
from util.query import use_read_replica_if_available from util.query import use_read_replica_if_available
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
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