Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
4

Sign up???

techde
techde

Hi everyone, I have a question about how to create a python Django 2.0 sign up form??? So far I have this::

from django.contrib import admin from django.urls import path, include from django.views.generic.base import TemplateView from django.conf.urls import url from . import views as core_views urlpatterns = [ url(r'^signup/$', core_views.signup, name='signup'), ] urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('django.contrib.auth.urls')), path('', TemplateView.as_view(template_name='index.html'), name='index'), path('post/', include('post.urls')), ]

Along with the HTML:

{% extends 'base.html' %} {% block content %} <h2>Sign up</h2> <form method="post"> {% csrf_token %} {% for field in form %} <p> {{ field.label_tag }}<br> {{ field }} {% if field.help_text %} <small style="color: grey">{{ field.help_text }}</small> {% endif %} {% for error in field.errors %} <p style="color: red">{{ error }}</p> {% endfor %} </p> {% endfor %} <button type="submit">Sign up</button> </form> {% endblock %}

Also:

  1. Further styling suggestions appreciated!
  2. constructive feedback on my project is accepted!

This project is:

A website where you can post to a database that displays on the UI using python integrated Django converted into HTML

Some forking ideas:

  1. Try to add more login credentials, such as: Google recaptcha, or Challenge PSWD's!
  2. Add a better showcase interface
  3. Improve on things like UI
  4. Anything you can imagine!

A quick vote:

loginbtn{ color:black }

Or

loginbtn{ color:grey }

Credits for some features in this project:

@Bookie0

@dublin
<- My code school(Hackingtons code school for kids)

@svanikthakur

User credentials!

User:Testuser
Pass:powerupthebeast
Pls note this is an entry lvl perms account, all actions done on this account are filtered and limited, cookies saved to this account, are terminated after 30 days.

2 years ago

Voters

Comments

TopNew
1
1
techde
techde

@KirikAltekar
Thx! but got any idea on how to fix the sign up it doesn't display on the screen?

2 years ago
1
littlepenguin
littlepenguin

Quick note: I do not know any Django

@techde
.

2 years ago
1
techde
techde

@KirikAltekar
Oh oof well thx for the feedback!

2 years ago
1
techde
techde

@KirikAltekar
Just for fun should I mark you answer as correct bc I dont think this is gonna get answered!?

2 years ago
1
techde
techde

This code is how it converts python into HTML

""" Django settings for mysite project. Generated by 'django-admin startproject' using Django 3.0.2. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'b#s*_o(3t3ai_k([email protected]=nj5#[email protected])mi=8fn67' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'post' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'mysite.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'mysite.wsgi.application' # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' ALLOWED_HOSTS = ['*'] X_FRAME_OPTIONS = '*' LOGIN_REDIRECT_URL="showcase/" LOGIN_REDIRECT_URL="/"
2 years ago
1
techde
techde

@techde
But it doesn't convert

2 years ago
Load more