Commit Graph

15 Commits

Author SHA1 Message Date
Jens Gutermuth
deb04500c5 Only use prefetched thumbnails if there are there
The optimization broke image uploading, this fixes it again.
2015-03-23 03:30:13 +01:00
Jens Gutermuth
9d4791b65a image can be loaded with a join as well (saves another query) 2015-03-23 02:30:54 +01:00
Jens Gutermuth
e4b8769168 DoesNotExist should be ObjectDoesNotExist, oops! 2015-03-23 02:28:21 +01:00
Jens Gutermuth
3bcc6d3152 Loanding pins does no N+1 queries anymore
This saves another three queries per pin, bringing to total query count
down to 8.

See issue #85 .
2015-03-23 02:22:35 +01:00
Jens Gutermuth
60cf2dcbd7 Fix three N+1 queries in pin loading
Fetch the submitter with a join and get all the images and tags in one
query each. This reduces the total query count for loading 50 pins from
304 to 158.

See issue #85.
2015-03-23 02:03:31 +01:00
Krzysztof Klimonda
7db42bb075 Generate thumbnails when image is being saved
Too lax unique constraints for Thumbnail coped with "on demand" thumbnail
generation may leave database in inconsistent state where two thumbnail for
the same size are saved. We should be able to prevent that from happening
by generating all thumbnails when we save the image. Should fix #24, but
I can't figure out a way to actually test it.
2013-04-16 00:30:43 +02:00
Krzysztof Klimonda
c0bf9d992e Make sure that users can't impersonate each other when creating pins
We weren't checking if the Pin submitter is the logged user which made it possible
to pass any submitter to the Pin resource create call. Fix it, and make the submitter
optional.
2013-04-05 19:34:31 +02:00
Krzysztof Klimonda
856d2d1e87 Allow filtering pins over submitter.username 2013-03-03 14:51:19 -08:00
Krzysztof Klimonda
e5bd3d577d Clean-up PinResource.build_filters method 2013-03-03 09:11:26 -08:00
Krzysztof Klimonda
d0d68545ca Add "origin" field to the Pin model
"origin" is an optional field that stores the URI for the site
that the image has been saved from, it's going to be used only from
bookmarklet. Fixes #63
2013-03-03 08:25:42 -08:00
Krzysztof Klimonda
8c3599911e In PinResource.save_m2m do nothing when no tags 2013-03-03 06:22:16 -08:00
Krzysztof Klimonda
53f05dbb6d A general project refactor
Removed pins django app, and moved code to the core. Moved user related
code out of core to the users app.
2013-03-03 04:47:34 -08:00
Krzysztof Klimonda
cf86da266a Add a very simplistic Pin access control for the API
As pointed in issue #75 we should get away with just checking if the pin
submitter is the currently logged in user. Assuming that we can implement
authorization for updating and deleting pins rather easily by subclassing
DjangoAuthorization so it passes the object to the Authorization backend.
2013-03-02 17:00:58 -08:00
Krzysztof Klimonda
a0e11a949e Add a small (125x125px) square thumbnail
This is going to be used by a "similar images" feature #74
2013-03-02 16:12:29 -08:00
Isaac Bythewood
fa7e8c3b83 Get basic working bookmarklet and refactor API into core 2013-02-26 23:20:50 +00:00