Skip to content

Commit

Permalink
Added urls and views
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniDiazTech committed May 26, 2021
1 parent 690bab2 commit 8714196
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from django.urls import path

from django.contrib.auth.views import LogoutView

from .views import SignUpView, CustomLoginView

app_name = 'user'

urlpatterns = [
path('signup/', SignUpView.as_view(), name='signup'),
path('login/', CustomLoginView.as_view(), name='login'),
path('logout/', LogoutView.as_view(), name='logout'),
]
8 changes: 4 additions & 4 deletions config/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class SignUpView(CreateView):

template_name = 'users/signup.html'

form = UserCreationForm
form_class = UserCreationForm

success_url = reverse_lazy('photo:list')

def form_valid(self, form):
to_return = super().form_valid(form)

user = authenticate(
username=form.cleaned_data["username"],
Expand All @@ -24,8 +24,8 @@ def form_valid(self, form):

login(self.request, user)

return super().form_valid(form)

return to_return
class CustomLoginView(views.LoginView):

template_name = 'users/login.html'

0 comments on commit 8714196

Please sign in to comment.