Advertisement
horozov86

DeleteView

Feb 23rd, 2024
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. class DeleteAlbumView(views.DeleteView):
  2.     queryset = Album.objects.all()
  3.     template_name = 'albums/album-delete.html'
  4.     success_url = reverse_lazy('index')
  5.     form_class = modelform_factory(Album, fields=('name', 'artist_name', 'genre', 'description', 'image_url', 'price'))
  6.  
  7.     def get_form_kwargs(self):
  8.         kwargs = super().get_form_kwargs()
  9.         kwargs["instance"] = self.object
  10.         return kwargs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement