Skip to content

Commit

Permalink
added login and registration view function
Browse files Browse the repository at this point in the history
  • Loading branch information
zecollokaris committed Mar 17, 2021
1 parent 487adbc commit 61fdd43
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 40 deletions.
Binary file modified Login/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified Login/__pycache__/urls.cpython-38.pyc
Binary file not shown.
10 changes: 9 additions & 1 deletion Login/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
# Application definition

INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.admin',
'registration'
'registration',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand Down Expand Up @@ -123,3 +124,10 @@
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = '/static/'



ACCOUNT_ACTIVATION_DAYS = 7 # One-Week Activation Expiry
REGISTRATION_AUTO_LOGIN = True # Automatically Log the User In.
SITE_ID = 1
LOGIN_REDIRECT_URL = '/'
21 changes: 7 additions & 14 deletions Login/urls.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
"""Login URL Configuration
"""Login URL Configuration"""

# Imports Views For Success to Render Content.
from Success import views
from django.urls import include

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path

urlpatterns = [
path('admin/', admin.site.urls),
# Includes Success url patterns
path('', include('Success.urls')),
]
Binary file added Success/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added Success/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added Success/__pycache__/views.cpython-38.pyc
Binary file not shown.
22 changes: 0 additions & 22 deletions Success/models.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
from django.db import models

# Create your models here.



#...Class User added here...
class Profile(models.Model):
#Attribute Variables for User class to represent different columns in database
'''
-bio-: used to describe user using text
posted by
-profile pic-: saved to profile picture folder created using django model
'''

user = models.OneToOneField(User,on_delete=models.CASCADE,)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
bio = models.CharField(max_length=350)


'''Method to filter database results'''
def __str__(self):
return self.profile.user
16 changes: 14 additions & 2 deletions Success/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
from django.conf.urls import url,include
from . import views
from Success import views
from django.contrib import admin
from django.urls import include, path
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
url(r'^$', views.index, name= 'index'),




#################################################################################################################################################################################
#URL FOR HOME PAGE
#################################################################################################################################################################################

#HOME Page url!

#This is the home page url pattern
path(r'', views.index, name= 'index'),
]

31 changes: 30 additions & 1 deletion Success/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
from django.shortcuts import render

# Create your views here.
#---------------------------------------------------------------------#
'''End Of Import'''
#---------------------------------------------------------------------#

# VIEW FUNCTIONS HERE!



#################################################################################################################################################################################
#HOME PAGE VIEW FUNCTION
#################################################################################################################################################################################

#Home page view function
def index(request):
title = 'Welcome: This is the Home Page'
context = {
"title": title,
}
return render(request, "Success/index.html",context)

#################################################################################################################################################################################
#REGISTRATION & LOGIN PAGE VIEW FUNCTION
#################################################################################################################################################################################


#Registration & Login page view function
def login(request):
return render(request, 'Registration/login.html')

#################################################################################################################################################################################

0 comments on commit 61fdd43

Please sign in to comment.