Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BN 0 8 python django.contrib django.contrib.auth get _ user _ model django.contrib.auth.mixins LoginRequiredMixin django.urls django.utils.translation gettext _ lazy _ django.views.generic import DetailView RedirectView UpdateView

BN08
" python
django.contrib
django.contrib.auth get_user_model
django.contrib.auth.mixins LoginRequiredMixin
django.urls
django.utils.translation gettext_lazy _
django.views.generic import DetailView RedirectView UpdateView
= get_user_model()
UserDetailView(Login RequiredMixin DetailView):
=
slug_field =""""
slug_url_kwarg =""""
user_detail_view = UserDetailView.as_view()
UserUpdateView(Login RequiredMixin UpdateView):
=
=[""""]
def get_success_url():
("":"" kwargs={""username"": self.request.user.username})
def get_object(self):
User.objects.get(username=self.request.user.username)
def form_valid():
messages.add_message(
self.request, messages.INFO, _(""Infos "")
)
super().form_valid(form)
user_update_view = UserUpdateView.as_view()
UserRedirectView(LoginRequiredMixin RedirectView):
=
def get_redirect_url(self):
("":"" kwargs={""username"": self.request.user.username})
user_redirect_view = UserRedirectView.as_view()
(#)"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions