Django: Galleries Admin Photo Upload - django

I have a website that is using Django's admin interface to facilitate non-developers adding content to the site. The site has an Events page (and associated model), and each Event can have an associated photo gallery.
I'm thinking that photo galleries should have their own model. There is a table in the database which associates image paths with their Event.
What I need is a way to upload images. Preferably a multiple-file upload solution since there could be dozens of images per event. I want these images to be recorded correctly in their table and added to the file system in the correct location on the server.
I was originally thinking that the upload feature should be included on the Event admin page to make it easier for content contributors, but maybe it would be easier to keep a separate photo gallery admin and have them select the Event the photos are associated with from there?
I've read through a lot of similar questions and blog posts, but nothing that seems to be quite exactly what I'm looking for. I'm currently attempting to adapt some of the information I've seen, but I'd really appreciate suggestions. Thanks for any help on this!

You can create Some model with foreign key to Event, and ManyToMany to your Images, as I understand your question.
At first upload necessary images to some Image model and than add them to Some model with some Event

Related

Does anyone know if i can add an image upload function to a form with cloudinary?

I'm building a Django blog in which i want registered users to be able to create their own blog posts including a title image.
i've incorporated cloudinary but can currently only upload images through the admin panel.
After reading through the docs and a few similar questions here i am none the wiser.
Has anyone encountered anything like this?
Is it possible to just put an image upload in my form and tie that in to cloudinary somehow?
please help!

Multiple image upload in Django admin for a gallery

I have spent a lot of time trying different ways to upload multiple images in Django admin but I have failed miserably. I have tried django-multiupload-admin which I didn't manage to make it work and inlines is not what I am looking for. I just want to select several images all at once, upload them under one category and them display them into a mansory gallery. I am willing to pay someone to help me find a simple way. Please help!
You can extend the Admin interface pretty easily using Javascript.
Here is the link ... it will help you design django admin with drag and drop method to upload images
Django Snippet Article about Image Upload

Upload images before form submit Django

I want to upload images Facebook style: select the images before submitting the form and when they are all uploaded, submit the form instantly. I know how to do it in the frontend, but the problem is in the backend. I have found some ways of managing the images in the backend but I'm not satisfied. The great deal of all this is avoiding to store the photos that won't be used, like if the user closes the browser while some photos are already uploaded. I have in mind 3 ways of doing the upload and I don't know which would be the best:
Create a "tmp" directory and place all the uploaded photos there, and when the form is submitted move all the used photos to another directory. (With this method there can be some concurrency problems)
Create a TempPhoto table in my database and do the same as the previous solution, moving the used photos from TempPhoto to the permanent table.
Add the photos directly to the permanent table and erase the ones that are not used (that are not related to other entity) at a scheduled time. (I suppose this would be the slower solution)
I think your first way with some reformations is the best way. You can create a tmp directory and attach a unique data (e.g. IP address) to each image that takes control on concurrency and then write some script in $(window).unload(...) for send a signal to the backend that remove the image(s) from tmp directory when user close window before submitting the form.

How do you upload multiple images to a blog post using django generic views?

I am trying to let my users upload multiple pictures to their blog posts. I have created a model for the blog post and a separate model for the images and used a foreign key to relate them. I was planning on using dropzone.js so that the user can drag and drop the pictures. I have looked into using formsets but can't get my head around them. Can anyone explain to a django beginner how to go about doing this? Or better yet give an example? Thanks!
I have done something similar using jquery-fileupload. Never used dropzone.js so maybe the explanation is not directly equivalent, but this is roughly what you do.
If you don't want to use formsets, upload the images via AJAX and add hidden fields to the form with the primary keys of the uploaded images, so you can attach them when saving the blogpost in Django. You will have to deal with orphaned images (those that were uploaded but the blogpost was never saved.)
If you want to use formsets, Django expects a format in the posted form data, you just need to make sure you create in your html (with dropzone js templating) the apropriate format Django is expecting, and also incrementing/decrementing the counter of the formset's management form.
Neither way is trivial, you need to pick a path and bang your head a few times before having it working.

Django App Configuration Options

I am making an app to allow a user to control a rotation of banners on their site. I have all the image stuff working. A user can upload images and captions and what not. What I am wondering is, how I would achieve some sort of configuration portion to where the user could determine how many images they want and which ones they want. So that when the view goes to the DB to get the images and the info, it is getting just the right amount and the right ones.
I suppose I could do this with a single table that is a sort of configuration table, or perhaps a single file that is edited through the admin to set config options, but maybe someone has a better idea.
You can do what you need by making a model to hold extra information that is then related to a user. Check out this section in the Django documentation, and it should get you going.