I've installed Django-Photologue and I can upload files and create galleries in my Django admin site. I've been searching the documentation below for examples on how to create a photo upload form so my users can create a gallery on my site but can't find a simple example to get me started. I've also setup their example application but it wasn't very helpful in terms of how to upload and create Galleries by POSTing from Views/Templates.
Docs: https://django-photologue.readthedocs.org/en/2.7/ https://code.google.com/p/django-photologue/
Can someone please provide a simple example of how I can create an upload form for submitting photos and creating a gallery for use with Django-Photologue ( not using just admin site)?
Thanks -
One thing missing from the answer above is you have to set the success_url in the CreateView.as_view. For example: CreateView.as_view(model=Photo, success_url='/')
Otherwise you'll receive a ImproperlyConfigured error.
This is quite simple, Photologue has all the relevant logic inside its models.
For example to setup photo upload, you can use CBV:
urls.py
In your template, remember to set enctype attribute, to handle files.
templates/photologue/photo_form.html
That's basically all you need.. as you can see, we don't use any custom logic, everything is encapsulated inside Photo model and the CBV does the rest.
The same applies to Gallery, just replace the model with Gallery and you're good to go. Obviously if you need some customization, you can do it as well, but that's outside the scope, since you didn't specify what use case you need to handle.