mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
parent
b7d3b057f3
commit
e69348b4e7
8 changed files with 34 additions and 23 deletions
|
@ -32,11 +32,11 @@ A simple example is the best illustration of this. Suppose we have the
|
|||
following model, which would represent entries in a Weblog::
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Entry(models.Model):
|
||||
title = models.CharField(maxlength=250)
|
||||
body = models.TextField()
|
||||
pub_date = models.DateTimeField()
|
||||
pub_date = models.DateField()
|
||||
enable_comments = models.BooleanField()
|
||||
|
||||
Now, suppose that we want the following steps to be applied whenever a
|
||||
|
@ -55,11 +55,11 @@ Accomplishing this is fairly straightforward and requires very little
|
|||
code::
|
||||
|
||||
from django.contrib.comments.moderation import CommentModerator, moderator
|
||||
|
||||
|
||||
class EntryModerator(CommentModerator):
|
||||
email_notification = True
|
||||
enable_field = 'enable_comments'
|
||||
|
||||
|
||||
moderator.register(Entry, EntryModerator)
|
||||
|
||||
The :class:`CommentModerator` class pre-defines a number of useful moderation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue