[profiles] Add settings form
This commit is contained in:
17
vrobbler/apps/profiles/views.py
Normal file
17
vrobbler/apps/profiles/views.py
Normal file
@ -0,0 +1,17 @@
|
||||
from django.urls import reverse_lazy
|
||||
from django.http.response import HttpResponseBadRequest
|
||||
from django.views.generic import FormView
|
||||
|
||||
from profiles.forms import UserProfileForm
|
||||
|
||||
|
||||
class ProfileDetailView(FormView):
|
||||
form_class = UserProfileForm
|
||||
template_name = "profiles/settings_form.html"
|
||||
success_url = reverse_lazy("profiles:profile_settings")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context_data = super().get_context_data(**kwargs)
|
||||
if self.request.user.is_anonymous:
|
||||
return HttpResponseBadRequest
|
||||
return context_data
|
||||
Reference in New Issue
Block a user