diff --git a/courseware/content_parser.py b/courseware/content_parser.py index 6203953fa4..75b14acbbe 100644 --- a/courseware/content_parser.py +++ b/courseware/content_parser.py @@ -7,7 +7,7 @@ from mako.lookup import TemplateLookup try: # This lets us do __name__ == ='__main__' from django.conf import settings - from models import UserProfile + from user.models import UserProfile except: settings = None diff --git a/courseware/models.py b/courseware/models.py index fd88bea16c..5110f1d24f 100644 --- a/courseware/models.py +++ b/courseware/models.py @@ -9,8 +9,6 @@ file and check it in at the same time as your model changes. To do that, 3. Add the migration file created in mitx/courseware/migrations/ """ -import uuid - from django.db import models from django.contrib.auth.models import User @@ -47,40 +45,3 @@ class StudentModule(models.Model): return self.module_type+'/'+self.student.username+"/"+self.module_id+'/'+str(self.state)[:20] -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.ForeignKey(User, unique=True, db_index=True) - name = models.TextField(blank=True, db_index=True) - language = models.TextField(blank=True, db_index=True) - location = models.TextField(blank=True, db_index=True) - meta = models.TextField(blank=True) # JSON dictionary for future expansion - courseware = models.TextField(blank=True, default='course.xml') - - -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() - diff --git a/courseware/module_render.py b/courseware/module_render.py index 85ece0f9cc..b4a0f994ba 100644 --- a/courseware/module_render.py +++ b/courseware/module_render.py @@ -19,7 +19,8 @@ from django.template import Context from django.template import Context, loader from mitxmako.shortcuts import render_to_response, render_to_string -from models import StudentModule, UserProfile +from models import StudentModule +from user.models import UserProfile import track.views import courseware.content_parser as content_parser diff --git a/courseware/views.py b/courseware/views.py index ffcac16951..a292c577b1 100644 --- a/courseware/views.py +++ b/courseware/views.py @@ -17,8 +17,10 @@ from django.db import connection from lxml import etree -from models import StudentModule, UserProfile from module_render import render_module, modx_dispatch +from models import StudentModule +from user.models import UserProfile + import courseware.content_parser as content_parser import courseware.modules.capa_module diff --git a/settings_new_askbot.py b/settings_new_askbot.py index 95b4a79d34..30513c260a 100644 --- a/settings_new_askbot.py +++ b/settings_new_askbot.py @@ -112,7 +112,7 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'courseware', - 'auth', + 'user', 'django.contrib.humanize', 'static_template_view', 'staticbook', diff --git a/urls.py b/urls.py index 567d219506..b10fde59c0 100644 --- a/urls.py +++ b/urls.py @@ -10,13 +10,13 @@ import django.contrib.auth.views urlpatterns = ('', url(r'^event$', 'track.views.user_track'), url(r'^t/(?P