Esempio n. 1
0
    def _create_admin_profile(self):
        staff_users = User.objects.filter(is_staff=True)
        admin = staff_users[0]
        print admin.username

        userprofile = UserProfile(user=admin)
        userprofile.save()
Esempio n. 2
0
    def _create_admin_profile(self):
        staff_users = User.objects.filter(is_staff=True)
        admin = staff_users[0]
        print admin.username

        userprofile = UserProfile(user=admin)
        userprofile.save()
Esempio n. 3
0
	def test_can_check_achievement_conditions(self):
		user = User(username='******', password=make_password('John'))
		user.save()
		userprofile = UserProfile(user=user)
		userprofile.referrals = 3
		userprofile.save()

		achievement1 = Achievement(name='referralsOne')
		achievement1.save()
		achievement2 = Achievement(name='referralsTwo')
		achievement2.save()
		achievement3 = Achievement(name='referralsThree')
		achievement3.save()

		self.assertEqual(achievements.referralsOne(user), True)

		userprofile.referrals = 6
		userprofile.save()

		self.assertEqual(achievements.referralsTwo(user), True)

		userprofile.referrals = 9
		userprofile.save()

		self.assertEqual(achievements.referralsThree(user), True)

		johnsAchievements = UserAchievement.objects.filter(userprofile=userprofile)
		self.assertEqual(3, johnsAchievements.count())
Esempio n. 4
0
	def test_user_can_be_assigned_an_experiment(self):
		experiment = Experiment(name='Cow',
			task_count=2,
			task_length=10,
			has_achievements=True,
			has_intake=True,
			has_followup=True,
			auto_tasking=True)
		experiment.save()
		saved_experiments = Experiment.objects.all()
		self.assertEqual(saved_experiments.count(), 1)

		user = User(username='******', password=make_password('Bob') )
		user.email = user.username
		user.save()

		saved_users = User.objects.all()
		self.assertEqual(saved_users.count(), 1)

		userprofile = UserProfile()
		userprofile.user = user
		userprofile.experiment = experiment
		userprofile.save()

		saved_profiles = UserProfile.objects.all()
		self.assertEqual(saved_profiles.count(), 1)

		named_experiment = saved_profiles[0].experiment
		self.assertEqual(named_experiment.name, 'Cow')
Esempio n. 5
0
def new_user(request):
	user = User(username=request.POST['username'])
	user.set_password(request.POST['password_1'])
	user.email = user.username
	user.save()

	userprofile = UserProfile()
	userprofile.user = user
	experiment = Experiment.objects.get(name=request.POST['experiment_name'])
	userprofile.experiment = experiment
	userprofile.save()

	# logic for assigning tasks
	if request.POST['product_name'] == 'all':
		# all products all tasks buffet style
		index = 0
		datasets = Dataset.objects.all()
		for dataset in datasets:
			products = dataset.product_set.all()
			for product in products:
				tasks = dataset.optask_set.all()
				tasks = tasks.filter(is_active=True)
				for task in tasks:
					newtasklistitem = TaskListItem()
					newtasklistitem.userprofile = userprofile
					newtasklistitem.op_task = task
					newtasklistitem.product = product
					newtasklistitem.index = index
					index = index + 1
					newtasklistitem.task_active = True
					newtasklistitem.save()
	else:
		# single product - task ordering assumed
		product = Product.objects.get(name=request.POST['product_name'])
		if str(request.POST['taskorder']) == 'b':
			print 'true'
			tasks = product.dataset.optask_set.all().order_by('id').reverse()
		else:
			tasks = product.dataset.optask_set.all().order_by('id')

		tasks = tasks.filter(is_active=True)

		index = 0
		for task in tasks:
			newtasklistitem = TaskListItem()
			newtasklistitem.userprofile = userprofile
			newtasklistitem.op_task = task
			newtasklistitem.product = product
			newtasklistitem.index = index
			# if index == 0 or experiment.sequential_tasks == False:
			# 	newtasklistitem.task_active = True
			# else:
			# 	newtasklistitem.task_active = False
			index = index + 1
			newtasklistitem.save()


	return redirect('exp_portal:view_users')
Esempio n. 6
0
	def test_can_get_profile_from_user(self):
		user = User(username='******', password=make_password('George'))
		user.email = user.username
		user.save()

		userprofile = UserProfile(exp_inst_complete=True, portal_inst_complete=True)
		userprofile.user = user 
		userprofile.save()

		saved_user = User.objects.all()[0]
		matched_profile = saved_user.userprofile

		self.assertEqual(userprofile.portal_inst_complete, True)
		self.assertEqual(userprofile.exp_inst_complete, True)
		self.assertEqual(userprofile.task_inst_complete, False)
Esempio n. 7
0
    def test_can_get_profile_from_user(self):
        user = User(username='******', password=make_password('George'))
        user.email = user.username
        user.save()

        userprofile = UserProfile(exp_inst_complete=True,
                                  portal_inst_complete=True)
        userprofile.user = user
        userprofile.save()

        saved_user = User.objects.all()[0]
        matched_profile = saved_user.userprofile

        self.assertEqual(userprofile.portal_inst_complete, True)
        self.assertEqual(userprofile.exp_inst_complete, True)
        self.assertEqual(userprofile.task_inst_complete, False)
Esempio n. 8
0
	def test_can_find_users_tasks(self):
		# create a bunch of users
		user1 = User(username='******', password=make_password('John'))
		user1.save()
		userprofile1 = UserProfile(user=user1)
		userprofile1.save()

		user2 = User(username='******', password=make_password('Paul'))
		user2.save()
		userprofile2 = UserProfile(user=user2)
		userprofile2.save()

		user3 = User(username='******', password=make_password('Ringo'))
		user3.save()
		userprofile3 = UserProfile(user=user3)
		userprofile3.save()

		# assign them some tasks 
		testdata = Dataset(name='testdata', version='1')
		testdata.save()

		testproduct = Product(dataset=testdata, name='testproduct', url='testproduct')
		testproduct.save()

		testtask1 = OpTask(dataset=testdata, name='task1')
		testtask1.save()
		testtask2 = OpTask(dataset=testdata, name='task2')
		testtask2.save()

		test_tli_1 = TaskListItem(userprofile=userprofile1,
								  product=testproduct,
								  op_task=testtask1,
								  index=0)
		test_tli_1.save()
		test_tli_2 = TaskListItem(userprofile=userprofile1,
								  product=testproduct,
								  op_task=testtask2,
								  index=1)
		test_tli_2.save()

		test_tlis = TaskListItem.objects.all()
		self.assertEqual(test_tlis.count(),2)

		# find the matches based on user profiles 
		saved_userprofiles = UserProfile.objects.all()
		for userprofile in saved_userprofiles:
			matched_task_items = userprofile.tasklistitem_set.all()
			if userprofile.user.username == 'John':
				self.assertEqual(matched_task_items.count(),2)
			else:
				self.assertEqual(matched_task_items.count(),0)
Esempio n. 9
0
	def test_can_count_completed_tasks(self):
		dataset = Dataset(version='1', name='test')
		dataset.save()

		task = OpTask(dataset=dataset, name='test_task', survey_url='test_url')
		task.save()

		user = User(username='******', password=make_password('paul'))
		user.save()

		userprofile = UserProfile(user=user)
		userprofile.save()

		product = Product(dataset=dataset, url='test_url')
		product.save()

		TaskListItem(
			userprofile=userprofile, 
			op_task=task,
			product=product,
			index=0,
			task_active=True,
			task_complete=False,
			exit_active=False,
			exit_complete=False).save()

		TaskListItem(
			userprofile=userprofile,
			op_task=task,
			product=product,
			index=1,
			task_active=False,
			task_complete=True,
			exit_active=False,
			exit_complete=False).save()

		saved_tasks = TaskListItem.objects.all()
		self.assertEqual(saved_tasks.count(), 2)

		self.assertEqual(saved_tasks.filter(task_active=True).count(), 1)
		self.assertEqual(saved_tasks.filter(task_complete=False).count(), 1)
Esempio n. 10
0
    def test_user_can_be_assigned_an_experiment(self):
        experiment = Experiment(name='Cow',
                                task_count=2,
                                task_length=10,
                                has_achievements=True,
                                has_intake=True,
                                has_followup=True,
                                auto_tasking=True)
        experiment.save()
        saved_experiments = Experiment.objects.all()
        self.assertEqual(saved_experiments.count(), 1)

        user = User(username='******', password=make_password('Bob'))
        user.email = user.username
        user.save()

        saved_users = User.objects.all()
        self.assertEqual(saved_users.count(), 1)

        userprofile = UserProfile()
        userprofile.user = user
        userprofile.experiment = experiment
        userprofile.save()

        saved_profiles = UserProfile.objects.all()
        self.assertEqual(saved_profiles.count(), 1)

        named_experiment = saved_profiles[0].experiment
        self.assertEqual(named_experiment.name, 'Cow')
Esempio n. 11
0
	def test_saving_and_retrieving_user(self):
		# either of the methods below works...
		user = User(username='******', password=make_password('Bob') )
		# user = User()
		# user.username = '******'
		# user.set_password('Bob')
		user.email = user.username
		user.save()

		saved_users = User.objects.all()
		self.assertEqual(saved_users.count(), 1)

		userprofile = UserProfile()
		userprofile.user = user
		userprofile.save()

		saved_profiles = UserProfile.objects.all()
		self.assertEqual(saved_profiles.count(), 1)

		first_profile = saved_profiles[0]
		self.assertEqual(first_profile.user.username, 'Bob')
		self.assertEqual(first_profile.user.username, first_profile.user.email)
Esempio n. 12
0
    def test_saving_and_retrieving_user(self):
        # either of the methods below works...
        user = User(username='******', password=make_password('Bob'))
        # user = User()
        # user.username = '******'
        # user.set_password('Bob')
        user.email = user.username
        user.save()

        saved_users = User.objects.all()
        self.assertEqual(saved_users.count(), 1)

        userprofile = UserProfile()
        userprofile.user = user
        userprofile.save()

        saved_profiles = UserProfile.objects.all()
        self.assertEqual(saved_profiles.count(), 1)

        first_profile = saved_profiles[0]
        self.assertEqual(first_profile.user.username, 'Bob')
        self.assertEqual(first_profile.user.username, first_profile.user.email)
Esempio n. 13
0
    def test_can_count_completed_tasks(self):
        dataset = Dataset(version='1', name='test')
        dataset.save()

        task = OpTask(dataset=dataset, name='test_task', survey_url='test_url')
        task.save()

        user = User(username='******', password=make_password('paul'))
        user.save()

        userprofile = UserProfile(user=user)
        userprofile.save()

        product = Product(dataset=dataset, url='test_url')
        product.save()

        TaskListItem(userprofile=userprofile,
                     op_task=task,
                     product=product,
                     index=0,
                     task_active=True,
                     task_complete=False,
                     exit_active=False,
                     exit_complete=False).save()

        TaskListItem(userprofile=userprofile,
                     op_task=task,
                     product=product,
                     index=1,
                     task_active=False,
                     task_complete=True,
                     exit_active=False,
                     exit_complete=False).save()

        saved_tasks = TaskListItem.objects.all()
        self.assertEqual(saved_tasks.count(), 2)

        self.assertEqual(saved_tasks.filter(task_active=True).count(), 1)
        self.assertEqual(saved_tasks.filter(task_complete=False).count(), 1)
Esempio n. 14
0
def new_user(request):
    user = User(username=request.POST['username'])
    user.set_password(request.POST['password_1'])
    user.email = user.username
    user.save()

    userprofile = UserProfile()
    userprofile.user = user
    experiment = Experiment.objects.get(name=request.POST['experiment_name'])
    userprofile.experiment = experiment
    userprofile.save()

    # logic for assigning tasks
    if request.POST['product_name'] == 'all':
        # all products all tasks buffet style
        index = 0
        datasets = Dataset.objects.all()
        for dataset in datasets:
            products = dataset.product_set.all()
            for product in products:
                tasks = dataset.optask_set.all()
                tasks = tasks.filter(is_active=True)
                for task in tasks:
                    newtasklistitem = TaskListItem()
                    newtasklistitem.userprofile = userprofile
                    newtasklistitem.op_task = task
                    newtasklistitem.product = product
                    newtasklistitem.index = index
                    index = index + 1
                    newtasklistitem.task_active = True
                    newtasklistitem.save()
    else:
        # single product - task ordering assumed
        product = Product.objects.get(name=request.POST['product_name'])
        if str(request.POST['taskorder']) == 'b':
            print 'true'
            tasks = product.dataset.optask_set.all().order_by('id').reverse()
        else:
            tasks = product.dataset.optask_set.all().order_by('id')

        tasks = tasks.filter(is_active=True)

        index = 0
        for task in tasks:
            newtasklistitem = TaskListItem()
            newtasklistitem.userprofile = userprofile
            newtasklistitem.op_task = task
            newtasklistitem.product = product
            newtasklistitem.index = index
            # if index == 0 or experiment.sequential_tasks == False:
            # 	newtasklistitem.task_active = True
            # else:
            # 	newtasklistitem.task_active = False
            index = index + 1
            newtasklistitem.save()

    return redirect('exp_portal:view_users')
Esempio n. 15
0
    def test_can_assign_user_achievements(self):
        # create a bunch of users
        user = User(username='******', password=make_password('John'))
        user.save()
        userprofile = UserProfile(user=user)
        userprofile.save()

        userTwo = User(username='******', password=make_password('Paul'))
        userTwo.save()
        userprofileTwo = UserProfile(user=userTwo)
        userprofileTwo.save()

        achievement = Achievement(name='One')
        achievement.save()

        achievement2 = Achievement(name='Two')
        achievement2.save()

        userachievement = UserAchievement()
        userachievement.achievement = achievement
        userachievement.userprofile = userprofile
        userachievement.save()

        userachievementTwo = UserAchievement()
        userachievementTwo.userprofile = userprofileTwo
        userachievementTwo.achievement = Achievement.objects.get(name='One')
        userachievementTwo.save()

        saved_achievements = Achievement.objects.all()
        self.assertEqual(saved_achievements.count(), 2)

        saved_userachievements = UserAchievement.objects.all()
        self.assertEqual(saved_userachievements.count(), 2)

        for saved_userachievement in saved_userachievements:
            if saved_userachievement.userprofile.user.username == 'Paul':
                self.assertEqual(saved_userachievement.achievement.name, 'One')

        try:
            johnAchievement = UserAchievement.objects.get(
                userprofile=userprofile, achievement=achievement2)
            self.assertEqual(johnAchievement.userprofile, userprofile)
        except ObjectDoesNotExist:
            print 'object does not exist'
            johnAchievements = UserAchievement.objects.get(
                userprofile=userprofile)
            print johnAchievements
Esempio n. 16
0
    def _create_user(self):
        # fix this later; need a logical method for experiment assignment
        saved_experiments = Experiment.objects.all()

        user = User(username='******', password=make_password('test'))
        user.email = user.username
        user.save()

        userprofile = UserProfile(user=user)
        userprofile.experiment = saved_experiments[0]
        userprofile.save()

        # get random product and sequence of operational tasks
        product = Product.objects.filter(is_active=True).order_by('?')[0]
        dataset = product.dataset
        matched_tasks = dataset.optask_set.filter(is_active=True).order_by('?')

        for index, task in enumerate(matched_tasks[0:matched_tasks.count()]):
            TaskListItem(userprofile=userprofile,
                         product=product,
                         op_task=task,
                         index=index,
                         task_active=False,
                         exit_active=False).save()
Esempio n. 17
0
    def _create_user(self):
        # fix this later; need a logical method for experiment assignment
        saved_experiments = Experiment.objects.all()

        user = User(username='******', password=make_password('test'))
        user.email = user.username
        user.save()

        userprofile = UserProfile(user=user)
        userprofile.experiment = saved_experiments[0]
        userprofile.save()

    	# get random product and sequence of operational tasks
        product = Product.objects.filter(is_active=True).order_by('?')[0]
        dataset = product.dataset
        matched_tasks = dataset.optask_set.filter(is_active=True).order_by('?')

    	for index, task in enumerate(matched_tasks[0:matched_tasks.count()]):
            TaskListItem(userprofile=userprofile, 
                product=product,
                op_task=task, 
                index=index, 
                task_active=False, 
                exit_active=False).save()
Esempio n. 18
0
	def test_can_assign_user_achievements(self):
		# create a bunch of users
		user = User(username='******', password=make_password('John'))
		user.save()
		userprofile = UserProfile(user=user)
		userprofile.save()

		userTwo = User(username='******', password=make_password('Paul'))
		userTwo.save()
		userprofileTwo = UserProfile(user=userTwo)
		userprofileTwo.save()

		achievement = Achievement(name='One')
		achievement.save()

		achievement2 = Achievement(name='Two')
		achievement2.save()

		userachievement = UserAchievement()
		userachievement.achievement = achievement
		userachievement.userprofile = userprofile
		userachievement.save()

		userachievementTwo = UserAchievement()
		userachievementTwo.userprofile = userprofileTwo
		userachievementTwo.achievement = Achievement.objects.get(name='One')
		userachievementTwo.save()

		saved_achievements = Achievement.objects.all()
		self.assertEqual(saved_achievements.count(), 2)

		saved_userachievements = UserAchievement.objects.all()
		self.assertEqual(saved_userachievements.count(), 2)

		for saved_userachievement in saved_userachievements:
			if saved_userachievement.userprofile.user.username == 'Paul':
				self.assertEqual(saved_userachievement.achievement.name, 'One')

		try:
			johnAchievement = UserAchievement.objects.get(userprofile=userprofile, achievement=achievement2)
			self.assertEqual(johnAchievement.userprofile, userprofile)
		except ObjectDoesNotExist:
			print 'object does not exist'
			johnAchievements = UserAchievement.objects.get(userprofile=userprofile)
			print johnAchievements
Esempio n. 19
0
def register(request):
    # TODO : add logging back in.  Good practice!!
    # Like before, get the request's context.
    context = RequestContext(request)

    # A boolean value for telling the template whether the registration was successful.
    # Set to False initially. Code changes value to True when registration succeeds.
    registered = False

    # If it's a HTTP POST, we're interested in processing form data.
    if request.method == 'POST':

        # Now we hash the password with the set_password method.
        # Once hashed, we can update the user object.
        user = User(username=request.POST['username'])
        user.set_password(request.POST['password'])
        user.email = user.username
        user.save()

        # Now sort out the UserProfile instance.
        # Since we need to set the user attribute ourselves, we set commit=False.
        # This delays saving the model until we're ready to avoid integrity problems.
        userprofile = UserProfile()
        userprofile.user = user

        # TODO: change this from default experiment 
        saved_experiments = Experiment.objects.get(name='fandf_experiment_2015')
        userprofile.experiment = Experiment.objects.get(name='fandf_experiment_2015')

        # Now we save the UserProfile model instance.
        userprofile.save()

        # Finally we assign tasks to the new user
        # Get a random product, get a random order of tasks
        # And save them to the task list
        product = Product.objects.filter(is_active=True).order_by('?')[0]
        dataset = product.dataset
        tasks = dataset.optask_set.filter(is_active=True).order_by('?')

        for index, task in enumerate(tasks):
            TaskListItem(userprofile=userprofile, op_task=task, product=product, 
                index=index, task_active=False).save()


        # Update our variable to tell the template registration was successful.
        registered = True

        # add some logic to log events, log in users directly
        print "successful registration of " + request.POST['username'] +" "+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        request.POST['email_to'] = user.email
        request.POST['email_subject'] = 'Welcome to XDATA Online'
        request.POST['email_message'] = 'successful registration'
        exp_portal.email.send_email(request)

        # login_participant(request)
        # return render(request, 'instructions/exp_instructions.html', {'user': request.user})

    # Not a HTTP POST, so we render our form using two ModelForm instances.
    # These forms will be blank, ready for user input.
    # else:
        # print "register without POST"
        # not sure what code belongs here yet but the two lines below are legacy...
        # user_form = UserForm()
        # profile_form = UserProfileForm()

    # Render the template depending on the context.
    # possibly change this to render task list - see notes above
    return render_to_response('registration/register.html', {'registered': registered}, context)
Esempio n. 20
0
    def test_can_check_achievement_conditions(self):
        user = User(username='******', password=make_password('John'))
        user.save()
        userprofile = UserProfile(user=user)
        userprofile.referrals = 3
        userprofile.save()

        achievement1 = Achievement(name='referralsOne')
        achievement1.save()
        achievement2 = Achievement(name='referralsTwo')
        achievement2.save()
        achievement3 = Achievement(name='referralsThree')
        achievement3.save()

        self.assertEqual(achievements.referralsOne(user), True)

        userprofile.referrals = 6
        userprofile.save()

        self.assertEqual(achievements.referralsTwo(user), True)

        userprofile.referrals = 9
        userprofile.save()

        self.assertEqual(achievements.referralsThree(user), True)

        johnsAchievements = UserAchievement.objects.filter(
            userprofile=userprofile)
        self.assertEqual(3, johnsAchievements.count())
Esempio n. 21
0
    def test_can_find_users_tasks(self):
        # create a bunch of users
        user1 = User(username='******', password=make_password('John'))
        user1.save()
        userprofile1 = UserProfile(user=user1)
        userprofile1.save()

        user2 = User(username='******', password=make_password('Paul'))
        user2.save()
        userprofile2 = UserProfile(user=user2)
        userprofile2.save()

        user3 = User(username='******', password=make_password('Ringo'))
        user3.save()
        userprofile3 = UserProfile(user=user3)
        userprofile3.save()

        # assign them some tasks
        testdata = Dataset(name='testdata', version='1')
        testdata.save()

        testproduct = Product(dataset=testdata,
                              name='testproduct',
                              url='testproduct')
        testproduct.save()

        testtask1 = OpTask(dataset=testdata, name='task1')
        testtask1.save()
        testtask2 = OpTask(dataset=testdata, name='task2')
        testtask2.save()

        test_tli_1 = TaskListItem(userprofile=userprofile1,
                                  product=testproduct,
                                  op_task=testtask1,
                                  index=0)
        test_tli_1.save()
        test_tli_2 = TaskListItem(userprofile=userprofile1,
                                  product=testproduct,
                                  op_task=testtask2,
                                  index=1)
        test_tli_2.save()

        test_tlis = TaskListItem.objects.all()
        self.assertEqual(test_tlis.count(), 2)

        # find the matches based on user profiles
        saved_userprofiles = UserProfile.objects.all()
        for userprofile in saved_userprofiles:
            matched_task_items = userprofile.tasklistitem_set.all()
            if userprofile.user.username == 'John':
                self.assertEqual(matched_task_items.count(), 2)
            else:
                self.assertEqual(matched_task_items.count(), 0)
Esempio n. 22
0
def register(request):
    # TODO : add logging back in.  Good practice!!
    # Like before, get the request's context.
    context = RequestContext(request)

    # A boolean value for telling the template whether the registration was successful.
    # Set to False initially. Code changes value to True when registration succeeds.
    registered = False

    # If it's a HTTP POST, we're interested in processing form data.
    if request.method == 'POST':

        # Now we hash the password with the set_password method.
        # Once hashed, we can update the user object.
        user = User(username=request.POST['username'])
        user.set_password(request.POST['password'])
        user.email = user.username
        user.save()

        # Now sort out the UserProfile instance.
        # Since we need to set the user attribute ourselves, we set commit=False.
        # This delays saving the model until we're ready to avoid integrity problems.
        userprofile = UserProfile()
        userprofile.user = user

        # TODO: change this from default experiment
        saved_experiments = Experiment.objects.get(
            name='fandf_experiment_2015')
        userprofile.experiment = Experiment.objects.get(
            name='fandf_experiment_2015')

        # Now we save the UserProfile model instance.
        userprofile.save()

        # Finally we assign tasks to the new user
        # Get a random product, get a random order of tasks
        # And save them to the task list
        product = Product.objects.filter(is_active=True).order_by('?')[0]
        dataset = product.dataset
        tasks = dataset.optask_set.filter(is_active=True).order_by('?')

        for index, task in enumerate(tasks):
            TaskListItem(userprofile=userprofile,
                         op_task=task,
                         product=product,
                         index=index,
                         task_active=False).save()

        # Update our variable to tell the template registration was successful.
        registered = True

        # add some logic to log events, log in users directly
        print "successful registration of " + request.POST[
            'username'] + " " + datetime.datetime.now().strftime(
                "%Y-%m-%d %H:%M:%S")
        request.POST['email_to'] = user.email
        request.POST['email_subject'] = 'Welcome to XDATA Online'
        request.POST['email_message'] = 'successful registration'
        exp_portal.email.send_email(request)

        # login_participant(request)
        # return render(request, 'instructions/exp_instructions.html', {'user': request.user})

    # Not a HTTP POST, so we render our form using two ModelForm instances.
    # These forms will be blank, ready for user input.
    # else:
    # print "register without POST"
    # not sure what code belongs here yet but the two lines below are legacy...
    # user_form = UserForm()
    # profile_form = UserProfileForm()

    # Render the template depending on the context.
    # possibly change this to render task list - see notes above
    return render_to_response('registration/register.html',
                              {'registered': registered}, context)