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
# Creator : Naman Tiwari (namantw) | |
# To run : Make sure Python 3 is installed and PyQt5 is installed | |
# Test : python dial.py <phone number> | |
# For example : 'python dial.py +9872621111' | |
from PyQt5.QtCore import Qt | |
from PyQt5.QtWidgets import (QApplication, QGridLayout, QLayout, QLineEdit, | |
QSizePolicy, QToolButton, QWidget) | |
class Button(QToolButton): |
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.db import models | |
from django.contrib.auth.models import User | |
class Student(models.Model): | |
user = models.OneToOneField( | |
User, | |
default=None, | |
null=True, | |
on_delete=models.CASCADE) |
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 import forms | |
from django.contrib.auth.models import User | |
from django.contrib.auth.forms import UserCreationForm | |
from .models import Student | |
from django import forms | |
class UserForm(UserCreationForm): | |
class Meta: | |
model = User |
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 |
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'), |