how to clear session automatically after a single event in django - django

I am developing a e-commerce project using django.It is a image based project where user can download image after subscription.
There is a single image download subscription package available to the user where user can only download an image for a single time.My home page have an image thumbnail.
If any user wants to download any image ,he can click on the selected image and then will take the user in the image detail page of the clicked image with download button option.If he subscribed,he can download the image.
Though its a single image download subscription,so user can only download a single image.but the problem is,after a single download,if the user don't leave the page,he is able to download the same image for an unlimited time.I want to restrict it but i have no idea how to do this in django.
After a single download,redirecting the user to the home page or my image thumbnail page can be solution,but i don't think it will be great idea.Because there will be a possibility to disconnection of internet or something right after the download event which will create situation where may be the user can not complete the download action.
so i want to settle the user in the image download page after a single download and immidietly wants to clear the session and restrict him to download the same image for unlimited time.
Can it be possible to clear the session after a single download,i think if i can clear the session after a single download or an event or whatever you say,then the user can not download the image for twice.Is it possible to clear the current session after an event in django?

Related

Image upload without page refresh and submit button

I have form type region, inside it I have three sub regions: one for image upload, second for uploaded images data view and third for uploaded images view. It's possible to upload image to database without page refresh and how I can make it? An idea is when user filling form, he can upload images and when he uploads images, list of uploaded images is updates (with dynamic action).
I have idea to create a dynamic action for page item "file browser" with change event, but how to upload an image to database without submit I don't know. Another problems is that I don't want refresh page, because user can loose filled data and data from form have to go to one table, but images to another.
Using the Dropzone plugin built for APEX is probably going to be your best option
https://github.com/Dani3lSun/apex-plugin-dropzone
This should be flexible enough to facilitate your non-submit needs, where it uploads into a collection after drag/drop, but before page submit.

Notification for new photo/video upload in Google Photo API

I'm working on a digital photo frame app with the new Google Photo Library API beta.
Assume that multiple devices are able to access the same album (shared album, or login with the same account), when there is a picture uploaded from one device, can other devices receive any notification regarding the new upload? If polling is needed for now (that's not really something efficient), what's the recommended interval for polling?
The platforms are Android (TV+Mobile)/iOS/tvOS
Right now there's no way to be notified of any changes to the library or albums.
You will need to poll an album (ie. list its contents) or the library to see if any new media has been added. For albums you could also just list the albums and check if the number of media inside it has changed.
The polling interval depends on your use case and how long of a wait is acceptable to your users. For example, you could run a manual refresh in the background every hour if your app isn't open and refresh more frequently when the user is interacting with your app. Maybe you could also include a 'refresh' button to trigger it manually?
Alternatively, if the entire process is handled through your application, you could also send a notification through a different notification service (Firebase Cloud Messaging) to notify your apps and server that a new media item has been added. This is something you'd need to implement yourself though.
This is definitely something that has come up before and I'd encourage you to file a feature request on our public issue tracker: https://developers.google.com/photos/library/support/how-to-get-help#missing-features

Enable download button in a Sitecore media field to Sitecore non admin users

I have a template called Classified Image which inherited from /sitecore/templates/System/Media/Versioned/File template. There are some items created from Classified Image template and each item contains an image in the Media field which is coming from /sitecore/templates/System/Media/Versioned/File template.
There are some Sitecore users without adminstrator privileges(admin testers) who simply wants to download that saved image in the classified image item. But I couldn't find a way to enable only this download option
for admin tester users so I had to give access to whole item by setting template standard values security. But the problem is even for downloading they have to acquire a lock by selecting "Lock and Edit" and later release that lock so other admin tester users won't be denied the acccess for that item.
Is there a simpler way I can configure this so this admin tester users will be able to download the image without acquiring any locks.
After navigating to the media item, have the user navigate to the Media tab and try the Download button there - this is illustrated by the screenshot below. If that doesn't work out you could implement a custom toolbar button that uses the Sitecore.SecurityModel.SecurityDisabler to allow downloads for otherwise unprivileged users
Note: This screenshot is from Sitecore 6.4.1

Application permissions

I have enabled a user of my application to enable permissions to view photo albums.
However, what I really want is to not only enable the application to access the photo albums but to enable the user to select one image from the album that other users of the application can then see thereafter.
This is a competition application so the user selects an image and that image is included in the competition but users of the application must be able to view so as they can vote on it.
Must I take the image from the photo album and upload to a hosting server or is there away I can do this?
What you need to do is an application in your server which saves the photo the user has selected. Then you save the reference of this photo into a database and when other users comes to your application you request all of these in the database and show them back to the user.
This is a pretty basic programming structure, so Facebook serves you with a lot of shared data through many profiles. On the other hand, you are in charge of what you do with these data, how you use it and in which applications you implement it. Remember when you do this, you have to provide a privacy policy and a terms of use document to avoid any legal consequence to your end.

Django - Preview uploaded picture prior to deciding to save

Like the title suggested, I want to implement a two-steps picture uploading mechanism.
User selects a picture to upload and
click on "Upload". Once the server
receives the request that contains
the picture, it would save the
picture in a temporary location, on
disk or memory, and the resize it to
a standard size, if needed. The
server then renders a new response
for the user to preview the uploaded
picture.
After previewing the picture, the user needs to click on "Save" to confirm for the server. The server then moves the picture from the temporary location to a permanent one and updates the corresponding entry in the DB.
What's a good way to implement this? What are some of the apps out there that might be able to help me? Thanks.
I would suggest either rolling your own (you might find it surprisingly easy, start with reading the docs on forms) or customizing django-photologue or django-filebrowser.