Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
piks3l
Respect My Net
Commits
e2b932df
Commit
e2b932df
authored
Jun 21, 2011
by
stef
Browse files
[enh] added admin interface for violations, comments, attachments and confirmations
parent
b2b0d4e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
bt/admin.py
0 → 100644
View file @
e2b932df
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
)
bt/models.py
View file @
e2b932df
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment