Skip to content

Instantly share code, notes, and snippets.

View souravs17031999's full-sized avatar
💭
print("No coffee ! Only Data ! ")

Sourav Kumar souravs17031999

💭
print("No coffee ! Only Data ! ")
View GitHub Profile
@namantw
namantw / urls.py
Last active January 13, 2019 13:05
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'),
@namantw
namantw / views.py
Last active January 13, 2019 13:05
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