summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraylu <raylu@cmu.edu>2011-05-12 17:50:31 -0400
committerraylu <raylu@cmu.edu>2011-05-12 17:50:31 -0400
commit930c971b57d24efa0ff1653977beabfb550dd664 (patch)
tree09247731a5f2fb09da9d69e5b27e2e437bc20d18
parent418ca3fc0dbeb46b40b5a1682fff19a37ebdd423 (diff)
downloadpyc-930c971b57d24efa0ff1653977beabfb550dd664.tar.xz
Add grader site and models for lab and assignment
-rw-r--r--pyc/grader/__init__.py0
-rw-r--r--pyc/grader/admin.py5
-rw-r--r--pyc/grader/models.py16
-rw-r--r--pyc/grader/views.py4
-rw-r--r--pyc/settings.py4
-rw-r--r--pyc/templates/index.html10
-rw-r--r--pyc/urls.py10
7 files changed, 42 insertions, 7 deletions
diff --git a/pyc/grader/__init__.py b/pyc/grader/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyc/grader/__init__.py
diff --git a/pyc/grader/admin.py b/pyc/grader/admin.py
new file mode 100644
index 0000000..acaa2b7
--- /dev/null
+++ b/pyc/grader/admin.py
@@ -0,0 +1,5 @@
+from grader.models import Lab, Submission
+from django.contrib import admin
+
+admin.site.register(Lab)
+admin.site.register(Submission)
diff --git a/pyc/grader/models.py b/pyc/grader/models.py
new file mode 100644
index 0000000..651ba6e
--- /dev/null
+++ b/pyc/grader/models.py
@@ -0,0 +1,16 @@
+from django.db import models
+
+class Lab(models.Model):
+ name = models.CharField(max_length=64)
+ due = models.DateField()
+ def __unicode__(self):
+ return self.name
+
+class Submission(models.Model):
+ from django.contrib.auth.models import User
+ lab = models.ForeignKey(Lab)
+ user = models.ForeignKey(User)
+ time = models.DateTimeField()
+ grade = models.IntegerField()
+ def __unicode__(self):
+ return "%d, %s" % (self.lab, self.user)
diff --git a/pyc/grader/views.py b/pyc/grader/views.py
new file mode 100644
index 0000000..35dba57
--- /dev/null
+++ b/pyc/grader/views.py
@@ -0,0 +1,4 @@
+from django.shortcuts import render_to_response
+
+def index(request):
+ return render_to_response('index.html')
diff --git a/pyc/settings.py b/pyc/settings.py
index 13f0ebd..69b3746 100644
--- a/pyc/settings.py
+++ b/pyc/settings.py
@@ -109,9 +109,8 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'pyc.urls'
TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
+ path.join(path.dirname(__file__), 'templates'),
)
INSTALLED_APPS = (
@@ -124,6 +123,7 @@ INSTALLED_APPS = (
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
+ 'grader',
)
# A sample logging configuration. The only tangible logging
diff --git a/pyc/templates/index.html b/pyc/templates/index.html
new file mode 100644
index 0000000..87bb880
--- /dev/null
+++ b/pyc/templates/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>pyc</title>
+</head>
+<body>
+woo
+</body>
+</html>
diff --git a/pyc/urls.py b/pyc/urls.py
index 55c42bd..92c79c9 100644
--- a/pyc/urls.py
+++ b/pyc/urls.py
@@ -4,11 +4,11 @@ from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
- # url(r'^$', 'pyc.views.home', name='home'),
- # url(r'^pyc/', include('pyc.foo.urls')),
+ url(r'^$', 'pyc.grader.views.index', name='index'),
+ # url(r'^pyc/', include('pyc.foo.urls')),
- # Uncomment the admin/doc line below to enable admin documentation:
- # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+ # Uncomment the admin/doc line below to enable admin documentation:
+ # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
- url(r'^admin/', include(admin.site.urls)),
+ url(r'^admin/', include(admin.site.urls)),
)