Найти - Пользователи
Полная версия: Ошибка при редактировании профиля: AttributeError at /profile/edit/
Начало » Django » Ошибка при редактировании профиля: AttributeError at /profile/edit/
1
lex912
Добрый день, подскажите: я настроил профиль пользователя, но при переходе (редактировать профиль) выходит ошибка

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
Подскажите, как исправить?
romankrv
в логе ошибки как раз и ответ - ‘ProfileEditView’ object has no attribute ‘user’
Добавте в ProfileEditView аттрибут user - это не больно и благодарные скажут вам спасибо.
#ТЫЖПРОГРАММИСТ
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB