-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to use django-bootstrap5 and add login capabilities to the demo
- Loading branch information
Showing
10 changed files
with
63 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "travel/base.html" %} | ||
{% load django_bootstrap5 %} | ||
{% block travel_heading %}<h1>Login</h1>{% endblock travel_heading %} | ||
{% block travel_content %} | ||
<form class="form" method="POST">{% csrf_token %} | ||
{% bootstrap_form form %} | ||
{% bootstrap_button button_type="submit" content="Login" %} | ||
</form> | ||
|
||
{% endblock travel_content %} |
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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
from django.urls import re_path, include | ||
from django.contrib.auth import urls as auth_urls | ||
from django.contrib.auth import logout as auth_logout | ||
from django import http | ||
from django.contrib import admin | ||
from django.views.generic import TemplateView | ||
|
||
|
||
def logout(request): | ||
auth_logout(request) | ||
return http.HttpResponseRedirect("/") | ||
|
||
|
||
urlpatterns = [ | ||
re_path(r"^$", TemplateView.as_view(template_name="home.html"), name="home"), | ||
re_path(r"^account/logout/$", logout, name="demo-logout"), | ||
re_path(r"^account/", include(auth_urls)), | ||
re_path(r"^admin/", admin.site.urls), | ||
re_path(r"^", include("travel.urls")), | ||
] |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION = (0, 50, 0) | ||
VERSION = (0, 51, 0) | ||
|
||
|
||
def get_version(): | ||
|
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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
{% load bootstrap5 tz %} | ||
{% load django_bootstrap5 tz %} | ||
{% timezone entity.tzinfo %} | ||
<form class="form-horizontal" action="" method="post" accept-charset="utf-8"> | ||
{% csrf_token %} | ||
{% bootstrap_form form layout="horizontal" horizontal_label_class='col-md-2' horizontal_field_class='col-md-8' %} | ||
{% buttons layout="horizontal" %} | ||
<button type="submit" class="btn btn-primary">Save</button> | ||
{% endbuttons %} | ||
{% bootstrap_button button_type="submit" content="Save" %} | ||
</form> | ||
{% endtimezone %} |