Tell me how I can modify my project my_holiday, so I can add additional logic with button Add Photo to the Place for example?
models.py
from django.db import models
class Place(models.Model):
name = models.CharField(max_length=200)
location = models.CharField(max_length=200)
description = models.TextField()
def __str__(self):
return self.name
class Photo(models.Model):
image = models.ImageField(upload_to='place_photos/')
places = models.ManyToManyField(Place, related_name='photos')
def __str__(self):
return f"Photo {self.id}"
views.py
class PhotoCreateView(CreateView):
model = Photo
form_class = PhotoForm
template_name = 'photo_create.html'
def form_valid(self, form):
place_id = self.request.GET.get('place_id')
place = get_object_or_404(Place, pk=place_id)
form.instance.place = place
return super().form_valid(form)
class PhotoEditView(UpdateView):
model = Photo
form_class = PhotoForm
template_name = 'photo_edit.html'
class PhotoDetailsView(DetailView):
model = Photo
template_name = 'photo_details.html'
photo_create.html
{% extends 'base.html' %}
{% block main_content %}
Add Photo
{% endblock %}
photo_edit.html
{% extends 'base.html' %}
{% block main_content %}
Edit Photo
{% endblock %}
photo_details.html
{% extends 'base.html' %}
{% block main_content %}
Photo Details
Image: 
Place: {{ object.place.location }}
{% endblock %}
travelogue_view.html
{% extends 'base.html' %}
{% block main_content %}
{% if places %}
Total places: {{ places|length }}
{% for place in places %}
{% for photo in place.photos.all %}
{% endfor %}
Location: {{ place.location }}
Category: {{ place.category }}
Add Photo
{% endfor %}
{% else %}
No places yet
{% endif %}
{% endblock %}
urls.py
from django.urls import path
from .views import PhotoCreateView, PhotoEditView, PhotoDetailsView
urlpatterns = [
path('photo/create/', PhotoCreateView.as_view(), name='photo_create'),
path('photo//edit/', PhotoEditView.as_view(), name='photo_edit'),
path('photo//', PhotoDetailsView.as_view(), name='photo_details'),
]