All pastes #175500 Raw Edit

Stuff

public python v1 · immutable
·published 2006-09-18 20:58 UTC
rendered paste body
pasfrom django.db import modelsfrom django.contrib.auth.models import Userfrom django.contrib.syndication.feeds import Feedfrom arrrt.middleware import threadlocalsclass Class(models.Model):    classname = models.CharField(maxlength=30, unique=True)     class Meta:	verbose_name = "Class"	verbose_name_plural = "Classes"    class Admin:        pass            def __str__(self):        return self.classname           class Group(models.Model):    groupname = models.CharField(maxlength=4)    classname = models.ForeignKey(Class)        class Meta:	unique_together = (("groupname", "classname"),)    class Admin:        list_display = ("groupname", "classname")        def __str__(self):        return '%s %s' % (self.groupname, self.classname)class Homework(models.Model):    course = models.ForeignKey(Class)    id = models.AutoField(primary_key=True)    duedate = models.DateField()    groups = models.ForeignKey(Group)    work = models.TextField()    summary = models.TextField(maxlength=30)    class Admin:        list_display = ("course", "duedate", "work", "groups", "summary")    def __str__(self):	return self.work	class HomeworkUpload(models.Model):    hwkfile = models.FileField(upload_to='homeworkbin')    homeworkid = models.ForeignKey(Homework)    mark = models.CharField(maxlength=3, blank=True)    owner = models.ForeignKey(User)    uptime = models.DateTimeField()    class Admin:        list_display = ("uptime", "hwkfile", "homeworkid")    def __str__(self):	return self.hwkfile	class NewsItem(models.Model):    title = models.CharField(primary_key=True, maxlength=50)    author = models.CharField(maxlength=20)    news = models.TextField()    class Admin:	list_display = ("title", "author", "news")class UserProfile(models.Model):        classes = models.ManyToManyField(Group)        USER_CHOICES = (           ('TE', 'Teacher'),           ('ST', 'Student'),           ('AD', 'Admin'),        )        permissions = models.CharField(maxlength=2, choices=USER_CHOICES)        user = models.OneToOneField(User)        class Admin:           pass	def __str__(self):	   return '%s' % (self.user)