aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge remote-tracking branch 'upstream/master' into authRodney Ewing2013-06-251-8/+105
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/app.py mediagoblin/auth/forms.py mediagoblin/auth/tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/edit/views.py mediagoblin/plugins/basic_auth/tools.py mediagoblin/tests/test_edit.py
| * \ Merge remote-tracking branch 'refs/remotes/joar/notifications'Christopher Allan Webber2013-06-221-5/+105
| |\ \ | | | | | | | | | | | | | | | | Conflicts: mediagoblin/db/migrations.py
| | * | New notificationsJoar Wandborg2013-06-091-5/+105
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added request.notifications - Email configuration fixes - Set config_spec default SMTP port to `0` and switch to SSL/non-SSL default if `port == 0` - Added email_smtp_use_ssl configuration setting - Added migrations for notification tables - Added __repr__ to MediaComment(Mixin) - Added MediaComment.get_entry => MediaEntry - Added CommentSubscription, CommentNotification, Notification, ProcessingNotification tables - Added notifications.task to celery init - Fixed a bug in the video transcoder where pygst would hijack the --help argument. - Added notifications - views - silence - subscribe - routes - utility methods - celery task - Added half-hearted .active comment CSS style - Added quick JS to show header_dropdown - Added fragment template to show notifications in header_dropdown - Added fragment template to show subscribe/unsubscribe buttons on media/comment pages - Updated celery setup tests with notifications.task - Tried to fix test_misc tests that I broke - Added notification tests - Added and extended tests.tools fixtures - Integrated new notifications into media_home, media_post_comment views - Bumped SQLAlchemy dependency to >= 0.8.0 since we need polymorphic for the notifications to work
| * / modified verification emails to use itsdangerous tokensRodney Ewing2013-05-291-3/+0
| |/
* / changed User model pw_hash field to nullable and added migrationsRodney Ewing2013-05-241-1/+1
|/
* Noting why we don't have an email uniqueness constraint in the db.Christopher Allan Webber2013-05-171-0/+4
| | | | This commit sponsored by Guido Günther. Thanks!
* Check for duplicate collection slugs and make them unique. Add unique ↵Rodney Ewing2013-04-241-1/+5
| | | | constraint to collection.slug model
* Use cascade for comment deletion.Elrond2013-04-081-7/+13
| | | | | Also use the relationship for getting the comments on a MediaEntry.
* Fix deleting media with attachments.Elrond2013-02-181-0/+1
| | | | | | | | | | | | | | If one deletes a media with attachments, there have been various problems: 1) If the file in the storage did not exist any more (maybe because due to a previous deletion attempt?), the error propagation failed, because the wrong thing was gathered. 2) The attachment database entries were not deleted. Using cascade for this, for now. Also add a simple unit test, that tests both by having a broken attachment on a media.
* Drop backward compatibility for media_data backref.Elrond2013-02-011-9/+1
| | | | Now we only support media_type backrefs with uselist=False.
* Drop media_data_table property.Elrond2013-02-011-6/+3
| | | | | Only when creating a new media_data row, we need the table. So load that locally in media_data_init().
* Rewrite media_data handling to use relationshipsElrond2013-02-011-20/+21
| | | | | | | | | | | | | | | | | | Instead of doing query by hand, use the relationships on the models to find the media_data. Is is made possible by the BACKREF_NAME in each models.py, which lets us know the local attr to ask for. Also initialize the relationship attribute on new media_data instead of the media_id. Also do not add it to the session. This gives us: - This automatically initializes the other side of the relationship, which will allow later acces via that way. - If the media_data is too early in the session, when the (new) media_entry is not yet in there, this could get conflicts. Avoid those by not adding to session. - Uses cascading to commit media_data together with the media_entry.
* Fix issue 611: Proper (back)relationship on MediaComment.Elrond2013-01-291-1/+7
| | | | well, fix the relationship on the comments.
* Use better relationships to delete collections.Elrond2013-01-231-5/+8
| | | | | | When deleting a User, his/her collections can be deleted by sqlalchemy: Collections do not need any special code to be executed on deletion.
* Add a license preference fieldMark Holmquist2013-01-171-0/+1
| | | | | | | | | | | | | This feature is absolutely necessary. Now a user can simply define their default license and quickly go through a form, as opposed to stopping to click on the select and choosing the same option over and over again. Also added DB migration for the field, so that's working now, too. Rebased by Sebastian and made the default value to be unicode. Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* import db.sql.util -> db.utilSebastian Spaeth2013-01-171-1/+1
| | | | | | | Merging an old branch, I reintroduced an import of db.sql.util rather than db.util. Fixing the glitch. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Implement User.delete() (#540)Sebastian Spaeth2013-01-171-1/+22
| | | | | | | | | Set User.collections to her Collections using the backref feature. This way we can iterate a user's collections and delete them all. Delete all MediaEntries/Files/attachments/comments/collections etc before finally deleting the User object. This is the backend work for issue 302 (allow a user to delete ones own account)
* Implement Collection.delete()Sebastian Spaeth2013-01-171-1/+10
| | | | | | Deleting a Collection should automatically delete all containing items. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Implement MediaEntry().delete() (#540)Sebastian Spaeth2013-01-171-3/+36
| | | | | | | | | | | | Deleting a MediaEntry instance will automatically delete all related comments and files/attachments. This moves implementation logic out of views.py and allows to make use of this functionality when e.g. deleting a User() account. Whenever a MediaEntry entry is deleted, this will also sql-delete the corresponding MediaFile entry. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Mv db.sql.base to db.baseSebastian Spaeth2013-01-071-2/+1
| | | | | | | | This concludes the db.sql.* -> db.* move. Our db abstraction layer is sqlalchemy, so there is no need to a separate db.sql.* hierarchy. All tests have been run for each of the commit series to make sure everything works at every step.
* Move mediagoblin.db.sql.extratypes to mediagoblin.db.extratypesSebastian Spaeth2013-01-071-1/+1
| | | | No other functional changes.
* Move db.sql.models* to db.models*Sebastian Spaeth2013-01-071-0/+447
|
* Move db/models.py -> db/mongo/models.pyElrond2011-12-201-363/+0
| | | | | To my surprise, there was only ONE reference to models.py. From open.py.
* Move db/migrations.py -> db/mongo/migrations.pyElrond2011-12-201-1/+1
| | | | And change references.
* Move db/util.py -> db/mongo/util.pyElrond2011-12-201-1/+1
| | | | | - Change some reference - Provide a wrapper db/util.py
* Dot-Notation for MediaEntry.media_dataElrond2011-12-051-2/+2
|
* Dot-Notation for MediaEntry.slugElrond2011-12-051-6/+6
|
* Dot-Notation for MediaEntry.titleElrond2011-12-051-1/+1
|
* Dot-Notation for MediaEntry.uploaderElrond2011-12-051-3/+3
|
* Dot-Notation for Users.pw_hashElrond2011-12-051-1/+1
|
* Dot-Notation for Users.usernameElrond2011-12-051-4/+4
|
* Rename MediaEntry.uploader() to .get_uploader()Elrond2011-11-221-4/+4
| | | | | | | | The .uploader() method conflicts with the uploader database field. As we're moving to .FIELD for db field access, this is a relevant conflict. So renaming .uploader() to .get_uploader()
* Added parameter ascending to MediaEntry::get_comments, if true, commentsPablo J. Urbano Santos2011-11-191-2/+7
| | | | will be ordered ascending, otherwise descending
* Dot-Notation for "_id"Elrond2011-11-151-5/+5
| | | | | | | | | Note: Migrations can't use "Dot Notation"! Migrations run on pymongo, not mongokit. So they can't use the "Dot Notation". This isn't really a big issue, as migrations are anyway quite mongo specific.
* Enable mongokit's "Dot notation"Elrond2011-11-151-0/+3
| | | | | | | | | | mongokit documents can allow to use x.FIELD instead of x["FIELD"]. First it looks a lot more pythonic. Second it might allow us an easier migration path towards an sqlalchemy database backend. Docs: http://namlook.github.com/mongokit/tutorial.html#dot-notation
* Merge remote-tracking branch 'remotes/nyergler/pep8-ification'Christopher Allan Webber2011-11-131-17/+18
|\ | | | | | | | | | | | | | | Conflicts: mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/user_pages/views.py mediagoblin/util.py
| * Whitespace and formatting cleanup.Nathan Yergler2011-10-011-17/+18
| | | | | | | | | | | | | | * Removed trailing whitespace * Line length < 80 where possible * Honor conventions on number of blank lines * Honor conventions about spaces around :, =
* | Finished splitting util.py into separate files.Aaron Williamson2011-10-011-7/+5
| |
* | Moved common, translation, template, and url code out of util.py and into ↵Aaron Williamson2011-10-011-2/+2
|/ | | | tools/[file].py
* Merge branch 'gullydwarf-cfdv-f357_lost_password_functionality'Christopher Allan Webber2011-09-081-0/+2
|\ | | | | | | | | Conflicts: mediagoblin/auth/routing.py
| * oops, uses Alejandro's fp_verification_key. my bad.Caleb Forbes Davis V2011-08-281-1/+1
| |
| * Adding fotgot password functionalityAlejandro Villanueva2011-08-281-0/+2
| |
* | 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|/
* Method to get the failure exception object for a MediaEntry, if appropriate.Christopher Allan Webber2011-08-141-0/+7
|
* Add fail_error and fail_metadata fields to MediaEntry and relevant migrationChristopher Allan Webber2011-08-131-1/+9
|
* Merge branch 'master' into processingChristopher Allan Webber2011-08-111-6/+1
|\ | | | | | | | | Conflicts: mediagoblin/db/migrations.py
| * Bug #372 - MediaEntry.thumbnail_file not usedCaleb Forbes Davis V2011-08-101-6/+1
| | | | | | | | | | - deleted the thumbnail_file from the media_entries collection - added a migration to remove the field from previous db versions
* | Merge branch 'master' into processingChristopher Allan Webber2011-08-101-1/+1
|\|
| * Merge branch 'remotes/gullydwarf-cfdv/f360_tagging' (early part) into mergetagsChristopher Allan Webber2011-07-301-1/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/config_spec.ini mediagoblin/edit/views.py mediagoblin/util.py
| | * changes tags to a list of dicts in the db, adding tag slugsCaleb Forbes Davis V2011-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - adds a function to convert the tag list of dicts to a text string properly delimited for loading into forms - tag string conversion function updated to generate list of dicts - updates all mentions of the conversion of the string to the tags db object - adds a tags template utility and updates the media template accordingly