Commit e2b932df authored by stef's avatar stef

[enh] added admin interface for violations, comments, attachments and confirmations

parent b2b0d4e4
from django.contrib import admin
from bt import models
class ViolationAdmin(admin.ModelAdmin):
pass
admin.site.register(models.Violation, ViolationAdmin)
class CommentAdmin(admin.ModelAdmin):
pass
admin.site.register(models.Comment, CommentAdmin)
class AttachmentAdmin(admin.ModelAdmin):
pass
admin.site.register(models.Attachment, AttachmentAdmin)
class ConfirmationAdmin(admin.ModelAdmin):
pass
admin.site.register(models.Confirmation, ConfirmationAdmin)
......@@ -66,6 +66,13 @@ class Violation(models.Model):
def confirmations(self):
return self.confirmation_set.filter(key='').count()
class Admin:
pass
def __unicode__(self):
return "#%s %s/%s" % (self.pk, self.country, self.operator)
class Comment(models.Model):
submitter_email = models.EmailField()
submitter_name = models.CharField(max_length=20)
......@@ -73,16 +80,31 @@ class Comment(models.Model):
timestamp = models.DateTimeField()
violation = models.ForeignKey(Violation)
class Admin:
pass
def __unicode__(self):
return "Comment #%s" % (self.pk)
class Attachment(models.Model):
storage = models.FileField(upload_to='static')
name= models.CharField(max_length=512)
comment = models.ForeignKey(Comment)
class Admin:
pass
def __unicode__(self):
return self.name
class Confirmation(models.Model):
key=models.CharField(max_length=64)
email=models.EmailField()
violation = models.ForeignKey(Violation)
class Admin:
pass
class ViolationModerator(CommentModerator):
email_notification = True
moderate_after = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment