diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-27 16:44:40 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-27 16:44:40 -0400 |
commit | 3aa3871b909500ae9198d63814dd79fd28921f93 (patch) | |
tree | 02fbde1fcc3c395f19dbb6e5004c6866ee28fb12 /mediagoblin/moderation/forms.py | |
parent | 6bba33d7e6fbb0cedc39f9a11f816fe5bd372ae7 (diff) | |
download | mediagoblin-3aa3871b909500ae9198d63814dd79fd28921f93.tar.lz mediagoblin-3aa3871b909500ae9198d63814dd79fd28921f93.tar.xz mediagoblin-3aa3871b909500ae9198d63814dd79fd28921f93.zip |
This commit had some important milestones in it. The major update is that now I
have mostly completed the moderator punishment and resolution of reports. Along
with this, I have also added one last table to the database: one that holds ar-
-chived (or resolved) reports. This is some of the primary functionality of my
whole update, so this is a big step! The other changes I made this update are
primarily organizational. I refactored some of my code into functions and I cl-
eaned up many of my templates.
--\ mediagoblin/db/models.py
--| Created the new ArchivedReport table
--| Removed columns from BaseReport table that are only necessary for Archived
| reports
--\ mediagoblin/db/migrations.py
--| Created the new ArchivedReport table
--| Removed columns from BaseReport table that are only necessary for Archived
| reports
--\ mediagoblin/db/util.py
--| Created the user_privileges_to_dictionary function. This is useful for
| accessing a user's permissions from within a template.
--\ mediagoblin/moderation/forms.py
--| Expanded the disciplinary actions a moderator can take
--| Allowed the moderator to choose more than one disciplinary action at a time
| (It's now managed with a list of checkboxes rather than radio buttons)
----| Pulled a MultiCheckBox class from a wtforms tutorial
--| Added various other form inputs for details of the moderator's disciplinary
| actions
--| Tried to ensure that every string is unicode and translated
--\ mediagoblin/moderation/tools.py
--| Created this file for holding useful moderation tools
--| Moved the penalizing code from views to the function take_punitive_actions
--| Added many more types of punitive actions
--| Added the archiving of old reports
--\ mediagoblin/moderation/views.py
--| Used the privileges_to_dictionary function for the Users Detail view to
| allow for different actions available to a moderator and an admin.
--| Added in functionality for ArchivedReports to the reports_detail and
| reports_panel views
--| Moved the punishments of repots_detail to tools.py (as mentioned above)
--\ mediagoblin/static/css/base.css
--| Added new styling for the User Detail page
--\ mediagoblin/static/images/icon_clipboard_alert.png
--| Added this image to represent unresolved reports
--\ mediagoblin/templates/mediagoblin/moderation/report.html
--| Added 'Return to Reports Panel' button
--| Fixed the spacing to be less that 80 columns wide
--| Added in display for Archived Reports
--\ mediagoblin/templates/mediagoblin/moderation/reports_panel.html
--| Changed the placement and columns of the tables
--| Fixed the spacing to be less that 80 columns wide
--| Added in display for Archived Reports
--\ mediagoblin/templates/mediagoblin/moderation/user.html
--| Fixed the spacing to be less that 80 columns wide
--| Took away the moderator's ability to add and remove privileges at will.
| Only the admin has this power now.
--\ mediagoblin/templates/mediagoblin/moderation/users_panel.html
--| Fixed the spacing to be less that 80 columns wide
--\ mediagoblin/tools/response.py
--| Added in code to remove a UserBan from a User if that user logs in after
| the expiration date
Diffstat (limited to 'mediagoblin/moderation/forms.py')
-rw-r--r-- | mediagoblin/moderation/forms.py | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/mediagoblin/moderation/forms.py b/mediagoblin/moderation/forms.py index 0a91b9b4..718cd8fa 100644 --- a/mediagoblin/moderation/forms.py +++ b/mediagoblin/moderation/forms.py @@ -17,24 +17,44 @@ import wtforms from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ -ACTION_CHOICES = [(_(u'takeaway'),_('Take away privilege')), - (_(u'userban'),_('Ban the user')), - (_(u'closereport'),_('Close the report without taking an action'))] +ACTION_CHOICES = [(_(u'takeaway'),_(u'Take away privilege')), + (_(u'userban'),_(u'Ban the user')), + (_(u'sendmessage'),(u'Send the user a message')), + (_(u'delete'),_(u'Delete the content'))] + +class MultiCheckboxField(wtforms.SelectMultipleField): + """ + A multiple-select, except displays a list of checkboxes. + + Iterating the field will produce subfields, allowing custom rendering of + the enclosed checkbox fields. + + code from http://wtforms.simplecodes.com/docs/1.0.4/specific_problems.html + """ + widget = wtforms.widgets.ListWidget(prefix_label=False) + option_widget = wtforms.widgets.CheckboxInput() + class PrivilegeAddRemoveForm(wtforms.Form): - giving_privilege = wtforms.HiddenField('',[wtforms.validators.required()]) privilege_name = wtforms.HiddenField('',[wtforms.validators.required()]) class ReportResolutionForm(wtforms.Form): - action_to_resolve = wtforms.RadioField( - _('What action will you take to resolve this report'), - validators=[wtforms.validators.required()], + action_to_resolve = MultiCheckboxField( + _(u'What action will you take to resolve the report?'), + validators=[wtforms.validators.optional()], choices=ACTION_CHOICES) targeted_user = wtforms.HiddenField('', validators=[wtforms.validators.required()]) + take_away_privileges = wtforms.SelectMultipleField( + _(u'What privileges will you take away?'), + validators=[wtforms.validators.optional()]) user_banned_until = wtforms.DateField( - _('User will be banned until:'), + _(u'User will be banned until:'), format='%Y-%m-%d', validators=[wtforms.validators.optional()]) + why_user_was_banned = wtforms.TextAreaField( + validators=[wtforms.validators.optional()]) + message_to_user = wtforms.TextAreaField( + validators=[wtforms.validators.optional()]) resolution_content = wtforms.TextAreaField() |