testappproj/testapp/models.py
author amit@thunder
Mon, 17 May 2010 22:33:59 +0530
changeset 0 0b061d58aea3
child 1 0eda880b3d25
permissions -rwxr-xr-x
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system

from django.db import models
from django.contrib.auth.models import User 
from django.contrib.auth.models import Group, Permission



# class ProblemPermission(models.Model):
#     """Abstract page permissions
#     """
#     #who
#     user = models.ForeignKey(User)
#     #what
#     can_change = models.BooleanField("can edit", default=False)
#     can_add = models.BooleanField("can add", default=False)
#     can_delete = models.BooleanField("can delete", default=False)

    
#     class Meta:
#         abstract = True
#         app_label = 'testapp'

PROBLEM_CHOICES=(
    ('P', 'Plotting'),
    ('S', 'Scripting'),
)


SESSION_CHOICES=(
  ('A','DAY 1 SESSION 1'),
  ('B','DAY 1 SESSION 2'),
  ('C','DAY 1 SESSION 3'),
  ('D','DAY 1 SESSION 4'),
  ('E','DAY 2 SESSION 1'),
  ('F','DAY 2 SESSION 2'),
  ('G','DAY 2 SESSION 3'),
  ('H','DAY 1 SESSION 4'),
  )

class Problem(models.Model):
  # name = models.CharField(blank=False,max_length=255)
  description = models.CharField(blank=False , max_length=255)
  problem_type=models.CharField(blank = False ,max_length=1, choices=PROBLEM_CHOICES)
  solution = models.CharField(blank=True ,max_length=255)
  solution_image = models.ImageField(blank = True ,upload_to='plots')
  session = models.CharField(blank=False ,max_length=1,choices=SESSION_CHOICES)
  author = models.CharField(max_length=255)
  created = models.DateTimeField()
  modified = models.DateTimeField()
  


  #if  user.has_perm('testapp.add_bar') and  user.has_perm('foo.change_bar') and user.has_perm('foo.delete_bar')

class Test_User(models.Model):
  #problem = models.ForeignKey('Problem')
  user = models.ForeignKey(User, unique=True)
  fullname=models.CharField(max_length=255)