summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authoradityacp2016-04-29 14:40:50 +0530
committeradityacp2016-04-29 14:40:50 +0530
commitd2affe68e84da54dc99d9876ab359ad448aa6828 (patch)
treece1062f424930806acce1a940dd14eb41b9077b7 /yaksh/models.py
parent3438ca95172897b594c216967d51cf5771d75f73 (diff)
downloadonline_test-d2affe68e84da54dc99d9876ab359ad448aa6828.tar.gz
online_test-d2affe68e84da54dc99d9876ab359ad448aa6828.tar.bz2
online_test-d2affe68e84da54dc99d9876ab359ad448aa6828.zip
changes for adding teachers
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py21
1 files changed, 2 insertions, 19 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index cb9582f..a4ea6c3 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -4,7 +4,7 @@ from random import sample, shuffle
from itertools import islice, cycle
from collections import Counter
from django.db import models
-from django.contrib.auth.models import User, Group
+from django.contrib.auth.models import User
from taggit.managers import TaggableManager
@@ -23,13 +23,6 @@ class Profile(models.Model):
department = models.CharField(max_length=64)
position = models.CharField(max_length=64)
- def is_moderator(self, user):
- return user.groups.filter(name='moderator').exists()
-
- def _add_to_group(self, user):
- group = Group.objects.get(name="moderator")
- user.groups.add(group)
-
languages = (
("python", "Python"),
("bash", "Bash"),
@@ -128,17 +121,7 @@ class Course(models.Model):
self.active = False
def add_teachers(self, *teachers):
- added_teachers = list()
- rejected_teachers = list()
- for teacher in teachers:
- if hasattr(teacher, 'profile'):
- if not teacher.profile.is_moderator(teacher):
- teacher.profile._add_to_group(teacher)
- self.teachers.add(teacher)
- added_teachers.append(teacher)
- else:
- rejected_teachers.append(teacher)
- return added_teachers, rejected_teachers
+ self.teachers.add(*teachers)
def get_teachers(self):
return self.teachers.all()