-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Done #745
base: master
Are you sure you want to change the base?
Done #745
Conversation
taxi/views.py
Outdated
|
||
|
||
def login_view(request: HttpRequest) -> HttpResponse: | ||
if request.method == "GET": | ||
form = AuthenticationForm() | ||
return render(request, "registration/login.html", {"form": form}) | ||
elif request.method == "POST": | ||
form = AuthenticationForm(data=request.POST) | ||
if form.is_valid(): | ||
user = form.get_user() | ||
login(request, user) | ||
return HttpResponseRedirect(reverse("taxi:index")) | ||
else: | ||
return render(request, "registration/login.html", {"form": form}) | ||
|
||
|
||
def logout_view(request) -> HttpResponse: | ||
form = AuthenticationForm() | ||
logout(request) | ||
return render(request, "registration/logged_out.html", {"form": form}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two views are unnecessary here, please use the logic and logout provided by Django out of the box, don't write your own view.
SECRET_KEY = ( | ||
SECRET_KEY = \ | ||
"django-insecure-8ovil3xu6=eaoqd#-#&ricv159p0pypoh5_lgm*)-dfcjqe=yc" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you change this?
Better to use ()
then \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flake8 said that it is too much of symbols
requirements.txt
Outdated
flake8==5.0.4 | ||
flake8-quotes==3.3.1 | ||
flake8-variables-names==0.0.5 | ||
pep8-naming==0.13.2 | ||
|
||
django-debug-toolbar~=4.4.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a blank line
{% extends "base.html" %} | ||
{% block content %} | ||
<p>You logged out of the site, to go back use this link:<a href="{% url "login" %}" class="btn btn-primary">Login</a></p> | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same here
requirements.txt
Outdated
flake8==5.0.4 | ||
flake8-quotes==3.3.1 | ||
flake8-variables-names==0.0.5 | ||
pep8-naming==0.13.2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove an unnecessary blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ!
No description provided.