Форум сайта python.su
Добрый день, подскажите: я настроил профиль пользователя, но при переходе (редактировать профиль) выходит ошибка
AttributeError at /profile/edit/
'ProfileEditView' object has no attribute ‘user’
Exception Value:
'ProfileEditView' object has no attribute ‘user’
views
class ProfileEditView(LoginRequiredMixin, UpdateView):
form_class = ProfileForm
model = Profile
def get_object(self):
return self.request.user.get_profile()
def get_success_url(self):
return reverse(“profiles_list”)
def form_valid(self, form):
response = super(ProfileEditView, self).form_valid(form)
messages.success(self.request, “You successfully updated your profile.”)
return response
Подскажите, как исправить?
Офлайн
в логе ошибки как раз и ответ - ‘ProfileEditView’ object has no attribute ‘user’
Добавте в ProfileEditView аттрибут user - это не больно и благодарные скажут вам спасибо.
#ТЫЖПРОГРАММИСТ
Офлайн