This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.urls import path | |
from selection import views | |
urlpatterns = [ | |
path('admin/', admin.site.urls), # automatically created by django | |
path('', views.home, name='register'), # when someone will access www.yourpage.com/ it will send request to 'home' view | |
path('reg_form/', views.register, name='reg_form'), | |
path('login/', views.user_login, name='login'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render, redirect | |
from .forms import UserForm, RegistrationForm, LoginForm, SelectionForm | |
from django.http import HttpResponse, Http404 | |
from selection.models import Student, Room, Hostel | |
from django.contrib.auth import authenticate, login, logout | |
from django.contrib.auth.decorators import login_required | |
def home(request): # the function will take request as input | |
return render(request, 'home.html') # the function then renders an html page template called home.html |