Add urls.py and move default template location to cryptolock folder
This commit is contained in:
parent
bd47658c8a
commit
9b7eadfb31
|
@ -3,7 +3,13 @@
|
|||
History
|
||||
-------
|
||||
|
||||
0.0.1 (2019-09-24)
|
||||
0.0.2 (2019-??-??)
|
||||
++++++++++++++++++
|
||||
|
||||
* A default urls.py is provided by the package so can work "out-of-the-box".
|
||||
* Default location for templates moved to ``django_cryptolock`` folder.
|
||||
|
||||
0.0.1 (2019-11-25)
|
||||
++++++++++++++++++
|
||||
|
||||
* First release on PyPI.
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
from django.conf.urls import url
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from . import views
|
||||
from .views import MoneroLoginView, MoneroSignUpView
|
||||
|
||||
|
||||
app_name = "django_cryptolock"
|
||||
urlpatterns = []
|
||||
urlpatterns = [
|
||||
url(r"login", MoneroLoginView.as_view(), name="login"),
|
||||
url(r"signup", MoneroSignUpView.as_view(), name="signup"),
|
||||
]
|
||||
|
|
|
@ -14,11 +14,12 @@ from .utils import verify_signature
|
|||
|
||||
|
||||
class MoneroLoginView(LoginView):
|
||||
template_name = "django_cryptolock/login.html"
|
||||
form_class = SimpleLoginForm
|
||||
|
||||
|
||||
class MoneroSignUpView(FormView):
|
||||
template_name = "registration/signup.html"
|
||||
template_name = "django_cryptolock/signup.html"
|
||||
form_class = SimpleSignUpForm
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
|
|
|
@ -16,12 +16,8 @@ Including another URLconf
|
|||
from django.conf.urls import url, include
|
||||
from django.contrib import admin
|
||||
|
||||
from testauth.views import IndexView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^admin/", admin.site.urls),
|
||||
url(r"", include("django_cryptolock.urls", namespace="django_cryptolock")),
|
||||
url(r"^auth/", include("testauth.urls")),
|
||||
url(r"^$", IndexView.as_view(), name="index"),
|
||||
url(r"^auth/", include("django_cryptolock.urls", namespace="django_cryptolock")),
|
||||
url(r"^", include("testauth.urls")),
|
||||
]
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
</li>
|
||||
{% if not request.user.is_authenticated %}
|
||||
<li>
|
||||
<a href="{% url 'test_signup' %}">Sign up</a>
|
||||
<a href="{% url 'django_cryptolock:signup' %}">Sign up</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'test_login' %}">Login</a>
|
||||
<a href="{% url 'django_cryptolock:login' %}">Login</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'django_cryptolock/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="{% url 'test_login' %}">
|
||||
<form method="post" action="{% url 'django_cryptolock:login' %}">
|
||||
{% csrf_token %}
|
||||
{{form}}
|
||||
<input type="submit" value="Login" />
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'django_cryptolock/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="{% url 'test_signup' %}" >
|
||||
<form method="post" action="{% url 'django_cryptolock:signup' %}" >
|
||||
{% csrf_token %}
|
||||
{{form}}
|
||||
<input type="submit" value="Sign Up" />
|
|
@ -5,11 +5,11 @@
|
|||
<h1>Hello {{request.user.username}}</h1>
|
||||
<p>Here are your details:</p>
|
||||
<ul>
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
<li>Address = {{user.address_set.first.address}}</li>
|
||||
<li>Date Joined = {{user.date_joined}}</li>
|
||||
<li>Last Login = {{user.last_login}}</li>
|
||||
</ul>
|
||||
<form method="post" action="{% url 'test_logout' %}">
|
||||
<form method="post" action="{% url 'logout' %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Logout" />
|
||||
</form>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.auth.views import LogoutView
|
||||
|
||||
from django_cryptolock.views import MoneroLoginView, MoneroSignUpView
|
||||
from .views import IndexView
|
||||
|
||||
urlpatterns = [
|
||||
url(r"login", MoneroLoginView.as_view(), name="test_login"),
|
||||
url(r"signup", MoneroSignUpView.as_view(), name="test_signup"),
|
||||
url(r"logout", LogoutView.as_view(), name="test_logout"),
|
||||
url(r"^logout$", LogoutView.as_view(), name="logout"),
|
||||
url(r"^$", IndexView.as_view(), name="index"),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue