aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages/forms.py
Commit message (Collapse)AuthorAgeFilesLines
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-3/+3
|
* wtforms.fields.TextField was deprecatedJakob Kramer2015-03-121-1/+1
| | | | | | | WTForms documentation: > The TextField alias for StringField is deprecated. Signed-off-by: Berker Peksag <berker.peksag@gmail.com>
* Fixes #899 : DeprecationWarning about Required going away in WTForms 3.0. ↵Loïc Le Ninan2014-06-131-3/+3
| | | | Replaced Required with InputRequired.
* Merge branch 'master' into OPW-Moderation-Updatetilly-Q2013-08-201-2/+2
|\ | | | | | | | | | | | | | | Conflicts: mediagoblin/db/models.py mediagoblin/decorators.py mediagoblin/routing.py mediagoblin/user_pages/views.py
| * Changed the target of the markdown links for opening in a new tab as ↵Emily O'Leary2013-08-071-2/+2
| | | | | | | | suggested by joar.
| * Added comment preview functionality to user pages. It works by passing the ↵Emily O'Leary2013-08-071-1/+1
| | | | | | | | | | | | comment's value as a JSON string to a new handler that lives at /ajax/comment/preview. The query string is decoded, unquoted, and has its leading and trailing quotes removed to match the input that cleaned_markdown_conversion expects. It does this in real time with a 500ms lag by using a timer. Initially I tried the onChange handler but you need to lose focus for that to process. The javascript timer is only invoked if the add comment button is pressed. A request is only sent if the comment box is not empty and the current value is not the same as the last value.
* | This is a very small commit. All that I have done here is to clean up my codetilly-Q2013-07-291-4/+2
| | | | | | | | | | | | a bit. I made it so that mediagoblin.user_pages.report recieves the report form as part of it's context. I also made sure I used {% trans %} tags effect- -ively.
* | Whew. This is a big update. I did some significant keeping work. I moved all oftilly-Q2013-07-171-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the folders and enpoints labeled 'admin' to the more accurate term of 'moderat- ion.' I also created the ability for admins and moderators to add or remove pr- ivileges or to ban a user in response to a report. This also meant implementing the UserBan class in various places. I also had to add a column called result to the ReportBase table. This allows the moderator/admin to leave comments when they respond to a report, allowing for archiving of what responses they do/n't take. --\ mediagoblin/db/migrations.py --| Added result column to ReportBase --\ mediagoblin/db/models.py --| Added result column to ReportBase --| Added documentation to tables I had made previously --\ mediagoblin/decorators.py --| Editted the user_has_privilege decorator to check whether a user has been | banned or not --| Created a seperate user_not_banned decorator to prevent banned users from | accessing any pages --| Changed require_admin_login into require_admin_or_moderator login --\ mediagoblin/gmg_commands/users.py --| Made the gmg command `adduser` create a user w/ the appropriate privileges --\ mediagoblin/moderation/routing.py << formerly mediagoblin/admin/routing.py --| Renamed all of the routes from admin -> moderation --\ mediagoblin/routing.py --| Renamed all of the routes from admin -> moderation --\ mediagoblin/moderation/views.py << formerly mediagoblin/admin/views.py --| Renamed all of the routes & functions from admin -> moderation --| Expanded greatly on the moderation_reports_detail view and functionality --| Added in the give_or_take_away_privilege form, however this might be a use- | -less function which I could remove (because privilege changes should happe- | n in response to a report so they can be archived and visible) --\ mediagoblin/static/css/base.css --| Added in a style for the reports_detail page --\ mediagoblin/templates/mediagoblin/base.html --| Renamed all of the routes from admin -> moderation --\ mediagoblin/templates/mediagoblin/moderation/report.html --| Added form to allow moderators and admins to respond to reports. --\ mediagoblin/templates/mediagoblin/moderation/reports_panel.html --| Fixed the table for closed reports --\ mediagoblin/templates/mediagoblin/moderation/user.html --| Added in a table w/ all of the user's privileges and the option to add or | remove them. Again, this is probably vestigial --| Renamed all of the routes from admin -> moderation --\ mediagoblin/templates/mediagoblin/moderation/user_panel.html --| Renamed all of the routes from admin -> moderation --\ mediagoblin/tools/response.py --| Added function render_user_banned, this is the view function for the redir- | -ect that happens when a user tries to access the site whilst banned --\ mediagoblin/user_pages/forms.py --| Added important translate function where I had text --\ mediagoblin/user_pages/lib.py --| Renamed functiion for clarity --\ mediagoblin/user_pages/views.py --| Added the user_not_banned decorator to every view --\ mediagoblin/views.py --| Added the user_not_banned decorator --\ mediagoblin/moderation/forms.py --| Created this new file --\ mediagoblin/templates/mediagoblin/banned.html --| Created this new file --| This is the page which people are redirected to when they access the site | while banned
* | In this commit, I have made a few changes and tightened up some of my modelstilly-Q2013-06-271-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | code. I added in two major pieces of functionality: table foundations and a decorator to confirm whether or not a user is a member of a certain group. Table Foundations are default rows that should be present in a given table as soon as the database is initialized. For example, I am using these to populate the core__groups table with all of the necessary groups ('moderator', 'com- menter', etc). Right now, this is achieved by adding a dictionary of parameters (with the parameters as lists) to the constant FOUNDATIONS in mediagoblin.db.models. The keys to this dictionary are uninstantiated classes. The classes which require foundations also have must have a constructor so that the list of parameters can be passed appropriately like so: Model(*parameters) In order to implement these foundations, I added the method populate_table_fou- -ndations to MigrationManager in mediagoblin.db.migration_tools. The decorator, called user_in_group, accepts as a parameter a unicode string, and then decides whether to redirect to 403 or let the user access the page. The identifier is the Group.group_name string, because I believe that will allow for the most readable code. I also added in the simple decorator require_admin_login. In terms of tightening up my code, I made many minor changes to my use of white space and made a few small documentation additions. I removed a vestigial class (ReportForm) from mediagoblin.user_pages.forms. I moved all of my migrations in- to one registered Migration. Setting up Foundations ============================== --\ mediagoblin/db/migration_tools.py --| created: MigrationManager.populate_table_foundations --| modified: MigrationManager.init_or_migrate to run | self.populate_table_foundations on init --\ mediagoblin/db/models.py --| created: FOUNDATIONS ----| created: group_foundations Working With Permissions ============================== --\ mediagoblin/decorators.py --| created: user_in_group --| created: require_admin_login --\ mediagoblin/user_pages/views.py --| modified: added decorator user_in_group to file_a_report --\ mediagoblin/admin/views.py --| modified: added decorator require_admin_login to all views functions General Code Tidying ============================= --/ mediagoblin/admin/views.py --/ mediagoblin/user_pages/forms.py --/ mediagoblin/db/models.py --/ mediagoblin/user_pages/lib.py --/ mediagoblin/user_pages/views.py --/ mediagoblin/db/migrations.py
* | This is the first stage of my project of implenting admin/moderator functiona-tilly-Q2013-06-241-0/+16
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lity. At this point, I have finished all the of basic work with the models! I still need to do some tightening of their documentation, but they seem to be working well. Working with Models ======================================== --\ mediagoblin/db/models.py --| Added in the Report model and table. This model is strictly a parent ----| Added in the CommentReport model which holds information about a report | filed against a comment. This class inherits from Report. ----| Added in the MediaReport model which holds information about a report f- | -iled against a media entry. This class inherits from Report. --| Added in a UserBan model and table. This model is in a one to one relatio- | -nship with User. This object acts as a marker for whether a user is banned | or not. --| Added in a Group model. These objects are in a many-to-many relationship | with User to explain which privileges a User has. ----| Added in GroupUserAssociation which is a table used to hold this many to | many relationship between Group & User. --\ mediagoblin/db/migrations.py --| Added in the migrations for all of the additions to models --| Added UserBan_v0 --| Added Report_v0 ----| Added CommentReport_v0 ----| Added MediaReport_v0 --| Added Group_v0 ----| Added GroupUserAssociation_v0 Working with Templates, Views, and Routing =============================================== >>> Reporting a Comment or a MediaEntry --\ mediagoblin/user_pages/views.py --| Added in the function file_a_report to allow user to file reports against | MediaEntries or Comments. Handles GET and POST requests. --| Added in the function file_a_comment_report which uses file_a_report but | also catches appropriate information for comment_ids. I may be able to do | this more eloquently with decorators. --\ mediagoblin/user_pages/routing.py --| Added in route 'mediagoblin.user_pages.media_home.report_media' | (linked to address /u/<user>/m/<media>/report/ ) --| Added in route ''mediagoblin.user_pages.media_home.report_comment' | (linked to address /u/<user>/m/<media>/c/<comment>/report/ ) --\ mediagoblin/templates/mediagoblin/user_pages/report.html --| I created this file to handle the filing of a report. --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Modified this file to add in links allowing users to report either media | or comments. --\ mediagoblin/user_pages/lib.py --| Added in build_report_form which processes data as either a CommentReport or | a MediaReport depending on which parameters are present --\ mediagoblin/user_pages/forms.py --| Added in CommentReportForm --| Added in MediaReportForm --| note: ReportForm is vestigial to an earlier strategy I used and I'll remove it | promptly --\ mediagoblin/decorators.py --| Added in 'get_media_comment_by_id' for use in mediagoblin/user_pages/views.py >>> New Admin Panels --\ mediagoblin/admin/views.py --| Added in the function admin_users_panel --| Added in the function admin_reports_panel --\ mediagoblin/admin/routing.py --| Added in route 'mediagoblin.admin.users' | (linked to address '/a/users') --| Added in route 'mediagoblin.admin.reports' | (linked to address '/a/reports/') --\ mediagoblin/templates/admin/user.html --| Created this file as a template for monitoring users --\ mediagoblin/templates/admin/report.html --| Created this file as a template for monitoring reports filed against media or | comments
* Fix-bug-667-Use-lazy_pass_to_ugettext-for-forms.Aditi Mittal2013-04-241-1/+1
|
* Mark "Collection" for translation in media_collect.Elrond2013-02-051-1/+3
|
* Moved MediaComment form descriptions to apt. placeJoar Wandborg2013-01-221-2/+5
|
* Added basic collection functionalityAaron Williamson2012-09-181-3/+19
|
* More/better translation.Elrond2012-03-171-1/+1
| | | | | | - Try to preserve some translations (somehow). - Mark "Tagged with" again for translation. - Do not translate the empty string
* It's 2012 all up in hereChristopher Allan Webber2012-02-021-1/+1
|
* Lots of changes to media page; rearranged things, added new styles, added ↵Jef van Schendel2011-12-091-1/+1
| | | | jquery bits, gave the comment section a refresh
* Moved common, translation, template, and url code out of util.py and into ↵Aaron Williamson2011-10-011-1/+1
| | | | tools/[file].py
* Updating the confirm delete form: checkboxes shouldn't be required, make ↵Christopher Allan Webber2011-09-051-2/+2
| | | | translatable
* Page Redesign to Delete confirmation pageShawn Khan2011-09-051-4/+2
|
* 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|
* Feature #403 - Ability to delete media entries - Fixes according to feedbackJoar Wandborg2011-08-301-0/+7
| | | | | | | | | | * Moved `mediagoblin.confirm` stuff to `mediagoblin.user_pages`, templates too. * Removed route extension for `mediagoblin.confirm` * Created `delete_media_files` which deletes all media files on the public_store when the entry is deleted * Created a new decorator to check if a user has the permission to delete an entry.
* Minor change to indentationChristopher Allan Webber2011-08-101-2/+2
|
* Ooops! We should do a fake ugettext passthrough here also.Christopher Allan Webber2011-08-101-1/+1
|
* Converting all forms to use the "fake/null" gettext conversion functionChristopher Allan Webber2011-08-101-3/+6
| | | | | Gettext doesn't actually get run right in the form but we do need to wrap the strings in _() so stuff extracts :)
* Updated `MediaCommentForm.field_comment` => `MediaCommentForm.comment_content`Joar Wandborg2011-07-071-21/+22
| | | | * Also changed file encoding of `user_pages/forms.py` from dos to unix.
* Issue #431 - Prevent comment link expiry - Added functionality for comment ↵Joar Wandborg2011-07-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | linking * `media.html` * Changed comment textarea handle from `comment` => `field_comment` * Active comment is hilighted with the CSS class name `comment_active` and also with the hyperlink anchor #comment * Changed media.html so that pagination always uses Route('mediagoblin.user_pages.media_home') as base_url * `user_pages/forms.py` * Renamed MediaComment form field `comment` => `field_comment` * `user_pages/routing.py` * Added route for `/u/joar/m/123..456/c/234..567/`, points to `media_home` * `user_pages/views.py` * `media_home` now checks if the request contains a comment id parameter then acts accordingly with pagination whether to call it with a `jump_to_id` or not. * `media_post_comment` - Updated MediaCommentForm field name `comment` => `field_comment` * `util.py` * `redirect` now supports querystring arguments. - NOT USED (should we keep it? I think so, it might be useful, sometime [don't call me a code hoarder]). * `Pagination.__init__` now accepts one further argument, the `jump_to_id`. It assist the comment linking functionality in finding and returning the proper page for a comment. This feature will work for all kinds of objects. It might not be optimal, but it is well functional :)
* Issue #362 - Added new `wtforms.Form`; `MediaCommentForm()`Joar Wandborg2011-06-291-0/+21
* ADDED `MediaCommentForm` is a form for `MediaComment` user entry and posting.