fromdjango.dbimportmodelsfromdjango.confimportsettingsAPP_NAMES=[]forappinsettings.INSTALLED_APPS:APP_NAMES.append((app,app))classMiddleware(models.Model):name=models.CharField(max_length=40)app_name=models.CharField(max_length=60,choices=APP_NAMES)process_request=models.BooleanField()process_view=models.BooleanField()process_template_response=models.BooleanField()process_response=models.BooleanField()process_exception=models.BooleanField()description=models.TextField()added_on=models.DateField(auto_now_add=True)def__unicode__(self):returnu"%s"%self.nameclassContextProcessor(models.Model):name=models.SlugField()app_name=models.CharField(max_length=60,choices=APP_NAMES)required_middleware=models.ManyToManyField(Middleware,blank=True)description=models.TextField()added_on=models.DateField(auto_now_add=True)def__unicode__(self):returnu"%s"%self.nameclassTemplateTag(models.Model):TYPE_LIST=(('Tag',((1,'Custom'),(2,'simple_tag'),(3,'inclusion_tag'),(4,'assignment_tag'),(5,'Block'),)),('Filter',((51,'Integer'),(52,'String'),(53,'Object'),(54,'Other'),)))tag_name=models.SlugField()# Use SlugField as it fits most of the validation checks for how a tag is formatted.tag_type=models.PositiveSmallIntegerField(choices=TYPE_LIST)app_name=models.CharField(max_length=60,choices=APP_NAMES)parameters=models.CharField(max_length=60,blank=True)takes_context=models.BooleanField()required_context=models.ManyToManyField(ContextProcessor,blank=True)template=models.CharField(max_length=80,blank=True,help_text='Template used by the tag/filter, if any.')examples=models.TextField()description=models.TextField()added_on=models.DateField(auto_now_add=True)def__unicode__(self):returnu"%s"%self.tag_name