register
This commit is contained in:
parent
d4415445f3
commit
d7dbc437fa
|
@ -0,0 +1,9 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Register">
|
||||
</form>
|
||||
{% endblock content %}
|
|
@ -18,7 +18,7 @@ urlpatterns = [
|
|||
),
|
||||
name="logout",
|
||||
),
|
||||
# path("players/", views.PlayerListView.as_view(), name="player_list"),
|
||||
path("accounts/register/", views.RegisterView.as_view(), name="register"),
|
||||
path(
|
||||
"players/create/", player_views.CreatePlayerView.as_view(), name="create_player"
|
||||
),
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from datetime import date
|
||||
from django.urls import reverse
|
||||
from django.views.generic import TemplateView, ListView, DetailView
|
||||
from django.views.generic.edit import CreateView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.forms import UserCreationForm
|
||||
from guild.models import Adventure, Character, Player, Reward
|
||||
|
||||
|
||||
|
@ -31,3 +33,11 @@ class HomeView(LoginRequiredMixin, TemplateView):
|
|||
context["resources"][reward.resource.name] = 0
|
||||
context["resources"][reward.resource.name] += reward.amount
|
||||
return context
|
||||
|
||||
|
||||
class RegisterView(CreateView):
|
||||
model = User
|
||||
form_class = UserCreationForm
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("guild:login")
|
||||
|
|
|
@ -76,6 +76,9 @@
|
|||
<li class="navigation-item">
|
||||
<a href="{% url 'guild:login' %}">Login</a>
|
||||
</li>
|
||||
<li class="navigation-item">
|
||||
<a href="{% url 'guild:register' %}">Register</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
{% csrf_token %}
|
||||
{{form}}
|
||||
<input type="submit" value="login">
|
||||
<a style="margin-left:4rem;" href="{% url 'guild:register' %}">Register</a>
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in New Issue