diff options
author | adityacp | 2016-04-27 16:42:32 +0530 |
---|---|---|
committer | adityacp | 2016-04-27 16:42:32 +0530 |
commit | 6b09383890b8367628124a854810326d7bbac7c4 (patch) | |
tree | 474ea52387e80a20580bba57120ef88b33f4c310 /yaksh/models.py | |
parent | fa11260fdbe76f377909483d9c482ecf72ab3364 (diff) | |
download | online_test-6b09383890b8367628124a854810326d7bbac7c4.tar.gz online_test-6b09383890b8367628124a854810326d7bbac7c4.tar.bz2 online_test-6b09383890b8367628124a854810326d7bbac7c4.zip |
changes after comments
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 6db1298..bb85085 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -24,13 +24,11 @@ class Profile(models.Model): position = models.CharField(max_length=64) def is_moderator(self, user): - return True if user.groups.filter(name='moderator').exists() else False + return user.groups.filter(name='moderator').exists() def _add_to_group(self, user): group = Group.objects.get(name="moderator") user.groups.add(group) - user.profile.position = "Faculty" - user.profile.save() languages = ( ("python", "Python"), @@ -139,6 +137,12 @@ class Course(models.Model): rejected_teachers.append(teacher) return added_teachers, rejected_teachers + def get_teachers(self): + return self.teachers.all() + + def remove_teachers(self, *teachers): + self.teachers.remove(*teachers) + def __unicode__(self): return self.name |