summaryrefslogtreecommitdiff
path: root/testapp/exam
diff options
context:
space:
mode:
authorhardythe12012-03-21 17:18:29 +0530
committerhardythe12012-03-21 17:18:29 +0530
commitd6b315e816525ee114a22e1c66a35b5e30e86258 (patch)
treeaf6a22d442f49d506989b89647c98824af108cab /testapp/exam
parent8bedc83e30c80636df18b301a84c69cb6a543e53 (diff)
parent2f21a4a007ae9b51fadd7832fe90506f19e309e2 (diff)
downloadonline_test-d6b315e816525ee114a22e1c66a35b5e30e86258.tar.gz
online_test-d6b315e816525ee114a22e1c66a35b5e30e86258.tar.bz2
online_test-d6b315e816525ee114a22e1c66a35b5e30e86258.zip
Merge branch 'admin_module' of github.com:hardythe1/online_test into admin_module
Diffstat (limited to 'testapp/exam')
-rw-r--r--testapp/exam/forms.py3
-rw-r--r--testapp/exam/models.py3
-rw-r--r--testapp/exam/urls.py1
-rw-r--r--testapp/exam/views.py4
4 files changed, 8 insertions, 3 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py
index 2a1ae6d..1a25312 100644
--- a/testapp/exam/forms.py
+++ b/testapp/exam/forms.py
@@ -3,7 +3,7 @@ from exam.models import Profile,Quiz,Question
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
-
+from taggit.forms import *
from string import letters, punctuation, digits
import datetime
@@ -138,6 +138,7 @@ class QuestionForm(forms.Form):
options = forms.CharField(widget = forms.Textarea(attrs={'cols': 40, 'rows': 1}),required=False)
type = forms.CharField(max_length=8, widget=forms.Select(choices=QUESTION_TYPE_CHOICES))
active = forms.BooleanField(required=False)
+ tags = TagField()
def save(self):
summary = self.cleaned_data["summary"]
diff --git a/testapp/exam/models.py b/testapp/exam/models.py
index 717e02e..4931e44 100644
--- a/testapp/exam/models.py
+++ b/testapp/exam/models.py
@@ -1,7 +1,7 @@
import datetime
from django.db import models
from django.contrib.auth.models import User
-
+from taggit.managers import TaggableManager
################################################################################
class Profile(models.Model):
"""Profile for a user to store roll number and other details."""
@@ -43,6 +43,7 @@ class Question(models.Model):
# Is this question active or not. If it is inactive it will not be used
# when creating a QuestionPaper.
active = models.BooleanField(default=True)
+ tags = TaggableManager()
def __unicode__(self):
return self.summary
diff --git a/testapp/exam/urls.py b/testapp/exam/urls.py
index e73ef2d..1e1cd12 100644
--- a/testapp/exam/urls.py
+++ b/testapp/exam/urls.py
@@ -11,6 +11,7 @@ urlpatterns = patterns('exam.views',
url(r'^(?P<q_id>\d+)/$', 'question'),
url(r'^(?P<q_id>\d+)/check/$', 'check'),
+
url(r'^manage/$', 'prof_manage'),
url(r'^manage/addquestion/$', 'add_question'),
url(r'^manage/addquestion/(?P<question_id>\d+)/$', 'add_question'),
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index 564f317..a529983 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -153,8 +153,10 @@ def add_question(request,question_id=None):
form = QuestionForm(request.POST)
if form.is_valid():
data = form.cleaned_data
- if question_id == None:
+ if question_id == None:
form.save()
+ question = Question.objects.order_by("-id")[0]
+ question.tags.add(form['tags'].data)
return my_redirect("/exam/manage/questions")
else:
d = Question.objects.get(id=question_id)