From 73b7a2e667ba5a99318e55f099856ae4e3714a2e Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 18 Jun 2012 14:08:15 -0400 Subject: [PATCH] Remove copy/paste instructor module. It was a bad idea anyway. =) --- cms/djangoapps/instructor/__init__.py | 0 cms/djangoapps/instructor/models.py | 61 --------------------------- cms/djangoapps/instructor/tests.py | 16 ------- cms/djangoapps/instructor/views.py | 49 --------------------- 4 files changed, 126 deletions(-) delete mode 100644 cms/djangoapps/instructor/__init__.py delete mode 100644 cms/djangoapps/instructor/models.py delete mode 100644 cms/djangoapps/instructor/tests.py delete mode 100644 cms/djangoapps/instructor/views.py diff --git a/cms/djangoapps/instructor/__init__.py b/cms/djangoapps/instructor/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/cms/djangoapps/instructor/models.py b/cms/djangoapps/instructor/models.py deleted file mode 100644 index 906aeee2f1..0000000000 --- a/cms/djangoapps/instructor/models.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -WE'RE USING MIGRATIONS! - -If you make changes to this model, be sure to create an appropriate migration -file and check it in at the same time as your model changes. To do that, - -1. Go to the mitx dir -2. ./manage.py schemamigration user --auto description_of_your_change -3. Add the migration file created in mitx/courseware/migrations/ -""" -import uuid - -from django.db import models -from django.contrib.auth.models import User - - -class UserProfile(models.Model): - class Meta: - db_table = "auth_userprofile" - - ## CRITICAL TODO/SECURITY - # Sanitize all fields. - # This is not visible to other users, but could introduce holes later - user = models.OneToOneField(User, unique=True, db_index=True, related_name='profile') - name = models.CharField(blank=True, max_length=255, db_index=True) - org = models.CharField(blank=True, max_length=255, db_index=True) - - -class Registration(models.Model): - ''' Allows us to wait for e-mail before user is registered. A - registration profile is created when the user creates an - account, but that account is inactive. Once the user clicks - on the activation key, it becomes active. ''' - class Meta: - db_table = "auth_registration" - - user = models.ForeignKey(User, unique=True) - activation_key = models.CharField(('activation key'), max_length=32, unique=True, db_index=True) - - def register(self, user): - # MINOR TODO: Switch to crypto-secure key - self.activation_key = uuid.uuid4().hex - self.user = user - self.save() - - def activate(self): - self.user.is_active = True - self.user.save() - #self.delete() - - -class PendingNameChange(models.Model): - user = models.OneToOneField(User, unique=True, db_index=True) - new_name = models.CharField(blank=True, max_length=255) - rationale = models.CharField(blank=True, max_length=1024) - - -class PendingEmailChange(models.Model): - user = models.OneToOneField(User, unique=True, db_index=True) - new_email = models.CharField(blank=True, max_length=255, db_index=True) - activation_key = models.CharField(('activation key'), max_length=32, unique=True, db_index=True) diff --git a/cms/djangoapps/instructor/tests.py b/cms/djangoapps/instructor/tests.py deleted file mode 100644 index 501deb776c..0000000000 --- a/cms/djangoapps/instructor/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/cms/djangoapps/instructor/views.py b/cms/djangoapps/instructor/views.py deleted file mode 100644 index fbb341b468..0000000000 --- a/cms/djangoapps/instructor/views.py +++ /dev/null @@ -1,49 +0,0 @@ -import logging - -from django.views.decorators.http import require_http_methods, require_POST, require_GET -from django.contrib.auth import logout, authenticate, login -from django.shortcuts import redirect -from mitxmako.shortcuts import render_to_response - -from django_future.csrf import ensure_csrf_cookie - -log = logging.getLogger("mitx.student") - - -@require_http_methods(['GET', 'POST']) -def do_login(request): - if request.method == 'POST': - return post_login(request) - elif request.method == 'GET': - return get_login(request) - - -@require_POST -@ensure_csrf_cookie -def post_login(request): - username = request.POST['username'] - password = request.POST['password'] - user = authenticate(username=username, password=password) - if user is not None: - if user.is_active: - login(request, user) - return redirect(request.POST.get('next', '/')) - else: - raise Exception("Can't log in, account disabled") - else: - raise Exception("Can't log in, invalid authentication") - - -@require_GET -@ensure_csrf_cookie -def get_login(request): - return render_to_response('login.html', { - 'next': request.GET.get('next') - }) - - -@ensure_csrf_cookie -def logout_user(request): - ''' HTTP request to log in the user. Redirects to marketing page''' - logout(request) - return redirect('/')