-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Fer-Bar/feature/auth-methods
Add authentication app for login and logout functionality; update templates
- Loading branch information
Showing
17 changed files
with
136 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AuthenticationConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'authentication' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.contrib.auth.forms import AuthenticationForm | ||
|
||
|
||
class UserLoginForm(AuthenticationForm): | ||
pass |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
|
||
{% block title %} | ||
Página de Inicio de Sesión | ||
{% endblock %} | ||
|
||
{% block styles %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
{% if messages %} | ||
<ul class="messages"> | ||
{% for message in messages %} | ||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
|
||
<form action="" method="post"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input type="submit" value="Submit"> | ||
<p><a href="#">Don't have an account?</a></p> | ||
</form> | ||
|
||
{% endblock %} | ||
|
||
{% block scripts %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django.contrib.auth.views import LoginView, LogoutView | ||
from django.urls import path | ||
|
||
from authentication.forms import UserLoginForm | ||
|
||
app_name = "authentication" | ||
urlpatterns = [ | ||
path( | ||
"login/", | ||
LoginView.as_view( | ||
template_name="authentication/login_page.html", form_class=UserLoginForm | ||
), | ||
name="login", | ||
), | ||
path( | ||
"logout/", | ||
LogoutView.as_view(), | ||
name="logout", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
|
||
{% block title %} | ||
Nuestros Miembros | ||
{% endblock %} | ||
|
||
{% block styles %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<ul> | ||
{% for person in people %} | ||
<li>{{ person }}</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
|
||
|
||
{% endblock %} | ||
|
||
{% block scripts %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.urls import path | ||
|
||
from people.views import PersonListView | ||
|
||
app_name = "people" | ||
urlpatterns = [ | ||
path("members/", PersonListView.as_view(), name="member-list"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.utils.decorators import method_decorator | ||
from django.views.decorators.http import require_http_methods | ||
from django.views.generic import ListView | ||
|
||
from people.models import Person | ||
|
||
|
||
@method_decorator(require_http_methods(["GET"]), name='dispatch') | ||
class PersonListView(ListView): | ||
queryset = Person.objects.filter(user__is_staff=True) | ||
context_object_name = "people" | ||
template_name = "people/members.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
from pet.views import main_page | ||
|
||
app_name = 'pet' | ||
urlpatterns = [ | ||
path("index/", main_page, name="main_page"), | ||
] |