def get_context(self, request, *args, **kwargs): gallery_page = self video = gallery_page.video talking_album = gallery_page.talking_album photo_album = gallery_page.photo_album gallery_context = { 'talking_album': { 'image': talking_album.slides.first().image, 'photographers': get_unique_photographers(talking_album), 'section_model': talking_album, }, 'photo_album': { 'image': photo_album.slides.first().image, 'photographers': get_unique_photographers(photo_album), 'section_model': photo_album, }, 'video': { 'image': video.featured_image, 'photographers': video.authors.all(), 'section_model': video, }, 'page': gallery_page, 'tab': 'gallery', 'current_page': 'gallery-home', } return gallery_context
def gallery_home_page(request, slug="gallery"): gallery_page = GalleryHomePage.objects.get(slug=slug) video = gallery_page.video talking_album = gallery_page.talking_album photo_album = gallery_page.photo_album gallery_context = { 'talking_album': { 'image': talking_album.slides.first().image, 'photographers': get_unique_photographers(talking_album), 'section_model': talking_album, }, 'photo_album': { 'image': photo_album.slides.first().image, 'photographers': get_unique_photographers(photo_album), 'section_model': photo_album, }, 'video': { 'image': video.featured_image, 'photographers': video.authors.all(), 'section_model': video, }, 'page': gallery_page, 'tab': 'gallery', 'current_page': 'gallery-home', } return render(request, "category/gallery_home_page.html", gallery_context)