title: How to have user log in and registration on same page using django
body: <p>Currently I have a user log in page and a user sign up page, how can I have both of these on one single page?</p>
  
  <p>Base.html:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;head&gt;
      {% block head %}
      &lt;title&gt;base&lt;/title&gt;
      {%  endblock %}
  &lt;/head&gt;
  
  &lt;body&gt;
  {%  block body %}
  
  {% endblock %}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>signup.html:</p>
  
  <pre><code>{% extends 'core/base.html' %}
  
  {% block head %}
      &lt;title&gt; Sign Up&lt;/title&gt;
  {% endblock %}
  {% block body %}
    &lt;h2&gt;Sign up&lt;/h2&gt;
  
    &lt;form method="post"&gt;
      {% csrf_token %}
      {{ form.as_p }}
      &lt;button type="submit"&gt;Sign up&lt;/button&gt;
    &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>login.html:</p>
  
  <pre><code>{%  extends 'core/base.html' %}
  
  {% block head %}
      &lt;title&gt; Login&lt;/title&gt;
  {% endblock %}
  
  {%  block body %}
  &lt;h1&gt;Login&lt;/h1&gt;
  
  &lt;form method = 'post'&gt;
      {% csrf_token %}
      {{ form.as_p }} &lt;!--'form' comes from login view imported in urls--&gt;
      &lt;button type = 'submit'&gt;Login&lt;/button&gt;
  &lt;/form&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>from django.conf.urls import url
  from django.contrib import admin
  from django.contrib.auth.views import login
  from core import views as core_views
  
  
  urlpatterns = [
      url(r'^$', core_views.login_redirect, name = 'login_redirect'),
      url(r'^admin/', admin.site.urls),
      url(r'^login/$', login, {'template_name': 'core/login.html'}, name='login'),
      url(r'^signup/$', core_views.signup, name='signup'),
      url(r'^account/$', core_views.account_page, name = 'account_page')
  
  ]
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from django.shortcuts import render
  
  from django.contrib.auth import login, authenticate
  from django.contrib.auth.forms import UserCreationForm
  from django.shortcuts import render, redirect
  from django.http import HttpResponse
  from django.contrib.auth.forms import UserCreationForm
  
  def login_redirect(request):
      return redirect('login')
  
  
  
  def signup(request):
      if request.method == 'POST':
          form = UserCreationForm(request.POST)
          if form.is_valid():
              form.save()
              return redirect('/account')
      else:
          form = UserCreationForm()
  
          args = {'form': form}
          return render(request, 'core/signup.html', args)
  
  
  def account_page(request):
      return HttpResponse('success')
  </code></pre>
  
  <p>How would I put both the log in and sign up on one page, if they are handled by separate views? Thank you in advance for your response! I have no more details to add and it is making me add more details i apologize for this unnecessary text.</p>