У меня есть родительский вид и дочерний вид.Я хочу переопределить одну пользовательскую функцию в дочернем представлении следующим образом:
Мои URL-адреса:
path('<int:place_id>/add_images/', AddImages.as_view(), name="add-images"),
path('<int:place_id>/edit/images/', EditImages.as_view(), name="edit-images"),
# PARENT:
class AddImages(LoginRequiredMixin, View):
template_name = images/add_images.html
# HERE I GET THE CURRENT URL:
def next_url(self):
next_url = "?next={0}".format(self.request.path)
print("NEXT URL:" + str(next_url))
return next_url
# AND I USE IT HERE:
def post(self, request, **kwargs):
# ...
next_url = self.next_url()
data = {'next_url' : next_url }
return JsonResponse(data)
# CHILD:
class EditImages(AddImages):
"""
Inherits from ImagesView. overwrites template and next_url
"""
template_name = "images/edit_images.html"
def next_url(self):
next_url = "?next={0}".format(self.request.path)
print("CHILD URL2:" + str(next_url))
return next_url
Я хочу переопределить родительские представления next_url и передать их в post ()
в настоящее время вывод выводит только: «СЛЕДУЮЩИЙ URL: ...»
Как я могу решить эту проблему?Заранее спасибо