<s> from django . db import models <EOL> from django . forms . models import ModelForm <EOL> from django import forms <EOL> from django . contrib import admin <EOL> from django . contrib . auth . models import User , Group <EOL> import string , datetime <EOL> from django . template . defaultfilters import slugify <EOL> class List ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT> ) <EOL> slug = models . SlugField ( max_length = <NUM_LIT> , editable = False ) <EOL> group = models . ForeignKey ( Group ) <EOL> def save ( self , * args , ** kwargs ) : <EOL> if not self . id : <EOL> self . slug = slugify ( self . name ) <EOL> super ( List , self ) . save ( * args , ** kwargs ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> objects = models . Manager ( ) <EOL> def incomplete_tasks ( self ) : <EOL> return Item . objects . filter ( list = self , completed = <NUM_LIT:0> ) <EOL> class Meta : <EOL> ordering = [ "<STR_LIT:name>" ] <EOL> verbose_name_plural = "<STR_LIT>" <EOL> unique_together = ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> class Item ( models . Model ) : <EOL> title = models . CharField ( max_length = <NUM_LIT> ) <EOL> list = models . ForeignKey ( List ) <EOL> created_date = models . DateField ( ) <EOL> due_date = models . CharField ( max_length = <NUM_LIT> , blank = True , null = True , ) <EOL> completed = models . BooleanField ( ) <EOL> completed_date = models . DateField ( blank = True , null = True ) <EOL> created_by = models . ForeignKey ( User , related_name = '<STR_LIT>' ) <EOL> assigned_to = models . ForeignKey ( User , related_name = '<STR_LIT>' ) <EOL> note = models . TextField ( blank = True , null = True ) <EOL> priority = models . PositiveIntegerField ( max_length = <NUM_LIT:3> ) <EOL> def __unicode__ ( self ) : <EOL> return self . title <EOL> def save ( self ) : <EOL> if not self . id : <EOL> self . created_date = datetime . datetime . now ( ) <EOL> if self . completed : <EOL> self . completed_date = datetime . datetime . now ( ) <EOL> super ( Item , self ) . save ( ) <EOL> class Meta : <EOL> ordering = [ "<STR_LIT>" ] <EOL> class Comment ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> author = models . ForeignKey ( User ) <EOL> task = models . ForeignKey ( Item ) <EOL> date = models . DateTimeField ( default = datetime . datetime . now ) <EOL> body = models . TextField ( blank = True ) <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . author , <EOL> self . date , <EOL> ) </s>
