Commits

Jernej Kos committed 33126bf

Made subject identifiers numeric.

Comments (0)

Files changed (2)

   def __unicode__(self):
     return self.title
 
-def generate_subject_sid():
-  return "".join([random.choice(string.uppercase + string.digits) for i in xrange(4)])
-
 class Subject(models.Model):
   class Meta:
     ordering = ['sid']
 
-  sid = models.CharField(primary_key = True, max_length = 15, editable = False, default = generate_subject_sid)
+  sid = models.AutoField(primary_key = True)
   created_at = models.DateTimeField(auto_now_add = True)
 
 class Answer(models.Model):

templates/survey/list.html

 Subjects:
 <hr/>
 {% for subject in survey.get_subjects %}
-<a href="{% url edit_survey survey.pk subject.pk %}">{{ subject.pk }}</a> ({{ subject.created_at }})<br/>
+<a href="{% url edit_survey survey.pk subject.pk %}">Subject {{ subject.pk }}</a> ({{ subject.created_at }})<br/>
 {% endfor %}
 <hr/>
 <a href="{% url enter_survey survey.pk %}">Enter new subject</a>