Эх сурвалжийг харах

Add grader site and models for lab and assignment

raylu 14 жил өмнө
parent
commit
930c971b57

+ 0 - 0
pyc/grader/__init__.py


+ 5 - 0
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)

+ 16 - 0
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)

+ 4 - 0
pyc/grader/views.py

@@ -0,0 +1,4 @@
+from django.shortcuts import render_to_response
+
+def index(request):
+	return render_to_response('index.html')

+ 2 - 2
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

+ 10 - 0
pyc/templates/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="UTF-8">
+	<title>pyc</title>
+</head>
+<body>
+woo
+</body>
+</html>

+ 5 - 5
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)),
 )