# Path: della/gallery/views.py
# class ImageUploadView(CreateView):
#     model = Image
#     form_class = ImageUploadForm
#     template_name = 'generic_crispy_form_template.html'
# 
#     def form_valid(self, form):
#         image = form.save(commit=False)
#         image.added_by = self.request.user
#         return super().form_valid(form)
# 
#     def get_success_url(self):
#         return reverse('gallery:image-detail', args=(self.object.id,))
# 
# class ImageDetailView(DetailView):
#     model = Image
# 
# class ImageListView(ListView):
#     model = Image
# 
#     def get_queryset(self):
#         queryset = super().get_queryset()
#         return queryset.order_by('-created_on')


from django.urls import path
from .views import ImageUploadView, ImageDetailView, ImageListView


app_name = 'gallery'

urlpatterns = [
    path('upload/', ImageUploadView.as_view(), name='upload'),
    path('<int:pk>/', ImageDetailView.as_view(), name='image-detail'),
    path('', ImageListView.as_view(), name='image-list')

# Path: della/gallery/views.py
# class ImageUploadView(CreateView):
#     model = Image
#     form_class = ImageUploadForm
#     template_name = 'generic_crispy_form_template.html'
# 
#     def form_valid(self, form):
#         image = form.save(commit=False)
#         image.added_by = self.request.user
#         return super().form_valid(form)
# 
#     def get_success_url(self):
#         return reverse('gallery:image-detail', args=(self.object.id,))
# 
# class ImageDetailView(DetailView):
#     model = Image
# 
# class ImageListView(ListView):
#     model = Image
# 
#     def get_queryset(self):
#         queryset = super().get_queryset()
#         return queryset.order_by('-created_on')


# Path: della/gallery/urls.py
from django.urls import path
from .views import ImageUploadView, ImageDetailView, ImageListView



app_name = 'gallery'

urlpatterns = [
    path('upload/', ImageUploadView.as_view(), name='upload'),
    path('<int:pk>/', ImageDetailView.as_view(), name='image-detail'),
    path('', ImageListView.as_view(), name='image-list')

]