├── README.md ├── db.sqlite3 ├── library ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── __init__.cpython-38.pyc │ ├── admin.cpython-37.pyc │ ├── admin.cpython-38.pyc │ ├── apps.cpython-38.pyc │ ├── forms.cpython-37.pyc │ ├── forms.cpython-38.pyc │ ├── models.cpython-37.pyc │ ├── models.cpython-38.pyc │ ├── views.cpython-37.pyc │ └── views.cpython-38.pyc ├── admin.py ├── apps.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_book.py │ ├── 0003_issuedbook.py │ ├── 0004_auto_20200406_1053.py │ ├── 0005_auto_20200407_0839.py │ ├── 0006_auto_20200409_1651.py │ ├── 0007_auto_20200412_1351.py │ ├── 0008_auto_20200412_1408.py │ ├── __init__.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-37.pyc │ │ ├── 0001_initial.cpython-38.pyc │ │ ├── 0002_book.cpython-37.pyc │ │ ├── 0002_book.cpython-38.pyc │ │ ├── 0003_issuedbook.cpython-37.pyc │ │ ├── 0003_issuedbook.cpython-38.pyc │ │ ├── 0004_auto_20200406_1053.cpython-37.pyc │ │ ├── 0004_auto_20200406_1053.cpython-38.pyc │ │ ├── 0005_auto_20200407_0839.cpython-37.pyc │ │ ├── 0005_auto_20200407_0839.cpython-38.pyc │ │ ├── 0006_auto_20200409_1651.cpython-37.pyc │ │ ├── 0006_auto_20200409_1651.cpython-38.pyc │ │ ├── 0007_auto_20200412_1351.cpython-37.pyc │ │ ├── 0007_auto_20200412_1351.cpython-38.pyc │ │ ├── 0008_auto_20200412_1408.cpython-37.pyc │ │ ├── 0008_auto_20200412_1408.cpython-38.pyc │ │ ├── __init__.cpython-37.pyc │ │ └── __init__.cpython-38.pyc ├── models.py ├── tests.py └── views.py ├── librarymanagement ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── __init__.cpython-38.pyc │ ├── settings.cpython-37.pyc │ ├── settings.cpython-38.pyc │ ├── urls.cpython-37.pyc │ ├── urls.cpython-38.pyc │ ├── wsgi.cpython-37.pyc │ └── wsgi.cpython-38.pyc ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py ├── manage.py ├── requirements.txt ├── static ├── images │ ├── Admin-icon.png │ ├── lib1.png │ ├── lib2.jpg │ ├── lib3.webp │ └── student.png └── screenshots │ ├── adminhomepage.png │ ├── availablebook.png │ ├── bookissued.png │ ├── homepage.png │ └── issuebook.png └── templates ├── library ├── aboutus.html ├── addbook.html ├── adminafterlogin.html ├── adminclick.html ├── adminlogin.html ├── adminsignup.html ├── bookadded.html ├── bookissued.html ├── contactus.html ├── contactussuccess.html ├── footer.html ├── index.html ├── issuebook.html ├── navbar.html ├── navbaradmin.html ├── navbarstudent.html ├── registration │ └── login.html ├── studentafterlogin.html ├── studentclick.html ├── studentlogin.html ├── studentsignup.html ├── viewbook.html ├── viewissuedbook.html ├── viewissuedbookbystudent.html └── viewstudent.html └── registration └── login.html /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Django based Library Management 4 | 5 | #### Django Library Management is a web application built with Django, Razorpay, and Tailwind CSS that provides an online platform for managing libraries. 6 | > 7 | 8 | [![Maintenance](https://img.shields.io/badge/maintained-yes-green.svg)](https://github.com/rajaprerak/MusicPlayer/commits/master) 9 | [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org) 10 | 11 | This project is built with : 12 | 13 | ![HTML5](https://www.w3.org/html/logo/downloads/HTML5_Logo_64.png) , ![CSS3](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/CSS3_logo_and_wordmark.svg/48px-CSS3_logo_and_wordmark.svg.png) , ![Vanilla JS](https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Unofficial_JavaScript_logo_2.svg/64px-Unofficial_JavaScript_logo_2.svg.png) , ![Python](https://www.quintagroup.com/++theme++quintagroup-theme/images/logo_python_section.png) , ![Django](https://www.quintagroup.com/++theme++quintagroup-theme/images/logo_django_section.png) 14 | 15 | 16 | 17 | ## Installation 📦 18 | ### To install Django Music Player, follow these steps: 19 | ## 1. Clone this repository: 20 | >'https://github.com/BurhanMohammad/Django-librarymanagement.git' 21 | ## 2. Navigate to the project directory: 22 | 23 | ```bash 24 | cd Django-librarymanagement 25 | ``` 26 | ## 3 . Create a virtual environment: 27 | ```bash 28 | python3 -m venv env 29 | ``` 30 | ## 4. Activate the virtual environment: 31 | ```bash 32 | source env/bin/activate 33 | ``` 34 | ## 5. Install the project dependencies: 35 | ```bash 36 | pip install -r requirements.txt 37 | ``` 38 | ## 6 . Run the server 39 | ```bash 40 | python manage.py runserver 41 | ``` 42 | ## 7 . Go to localhost:8000 43 | --- 44 | 45 | ## Features of this project: 46 | 47 | ##### Anyone can 48 | 49 | 1. see all the books in homepage 50 | 2. search books based on author or name of the book or category of the book 51 | 3. sort books or author alphabetically 52 | 53 | ##### Student can 54 | 55 | 1. login / signup , 56 | 2. can request book 57 | 3. see their own issues and filter them based on : 58 | 59 | - requested issues , 60 | - issued books or 61 | - all of them together 62 | 63 | 4. check their own fines 64 | 5. can see 65 | 66 | - the days remaining to return a particular book 67 | **or** 68 | - the number of days passed the return date of a particular book in the my fines page 69 | 70 | 6. Pay their fines online (powered by RazorPay) 71 | 72 | ##### Admin can 73 | 74 | 1. login to admin dashboard 75 | 2. check all issues : 76 | 77 | - see issues , 78 | - delete issues , 79 | - search issues by studentid 80 | - filter issues based on : 81 | 82 | - issued or not, 83 | - returned or not , 84 | 85 | 3. accept a issue : 86 | 87 | - from the dashboard where admin has to manually select return date 88 | **or** 89 | - from the Issue requests page where return date is automatically calculated 90 | 91 | 4. add , delete search books and filter books based on author 92 | 5. add , delete , search author 93 | 6. calculate fine by clicking a button , 94 | 7. create, delete fine ,search fines for studentid 95 | 8. toggle fine paid status (if paid in cash) 96 | 9. search ,modify,add,delete students , filter them based on department and check all fines and issues of that student 97 | 10. can see the last-login , date joined & the student associated to a particular user 98 | 11. can change password for any user 99 | 100 | ##### More ... 101 | 102 | 1. while signing up if studentID is already associated to a user in this platform then it will show a error without reloading the page and as soon as correct id is given then the error will go away 103 | 2. Books in homepage will show status of `issued` , `issue requested` or `request issue` based on whether the book is issued or requested for a issue or is not requested for logged-in students only 104 | 105 | --- 106 | 107 | ## Usage: 108 | ### To install Django Music Player, follow these steps: 109 | ## 1. Run the server: 110 | 111 | ```bash 112 | python manage.py runserver 113 | ``` 114 | 115 | ## 2. Open your web browser and go to: 116 | >'http://localhost:8000/' 117 | ## 3 . Sign up for a new account or log in with an existing one. 118 | 119 | ## 4. Add some books to the library. 120 | 121 | ## 5. Borrow and return books as needed. 122 | 123 | ## 6 . Make online payment using Razorpay payment gateway. 124 | 125 | 126 | ## Contributing 💡 127 | 128 | #### If you'd like to contribute to Django Library Management, feel free to fork this repository and submit a pull request. For more information on contributing to the project, please check out my repository. 129 | 130 | 131 | #### Step 1 132 | 133 | - **Option 1** 134 | - 🍴 Fork this repo! 135 | 136 | - **Option 2** 137 | - 👯 Clone this repo to your local machine. 138 | 139 | 140 | #### Step 2 141 | 142 | - **Build your code** 🔨🔨🔨 143 | 144 | #### Step 3 145 | 146 | - 🔃 Create a new pull request. 147 | ## Creadits : 148 | 149 | #### Django Library Management was created by Mohammad Burhan 150 | 151 | 152 | ## License 153 | [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org) 154 | 155 | - **[MIT license](http://opensource.org/licenses/mit-license.php)** 156 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/db.sqlite3 -------------------------------------------------------------------------------- /library/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__init__.py -------------------------------------------------------------------------------- /library/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /library/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /library/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /library/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /library/__pycache__/apps.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/apps.cpython-38.pyc -------------------------------------------------------------------------------- /library/__pycache__/forms.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/forms.cpython-37.pyc -------------------------------------------------------------------------------- /library/__pycache__/forms.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/forms.cpython-38.pyc -------------------------------------------------------------------------------- /library/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /library/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /library/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /library/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /library/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Book,StudentExtra,IssuedBook 3 | # Register your models here. 4 | class BookAdmin(admin.ModelAdmin): 5 | pass 6 | admin.site.register(Book, BookAdmin) 7 | 8 | 9 | class StudentExtraAdmin(admin.ModelAdmin): 10 | pass 11 | admin.site.register(StudentExtra, StudentExtraAdmin) 12 | 13 | 14 | class IssuedBookAdmin(admin.ModelAdmin): 15 | pass 16 | admin.site.register(IssuedBook, IssuedBookAdmin) 17 | -------------------------------------------------------------------------------- /library/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class LibraryConfig(AppConfig): 5 | name = 'library' 6 | -------------------------------------------------------------------------------- /library/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.models import User 3 | from . import models 4 | 5 | class ContactusForm(forms.Form): 6 | Name = forms.CharField(max_length=30) 7 | Email = forms.EmailField() 8 | Message = forms.CharField(max_length=500,widget=forms.Textarea(attrs={'rows': 3, 'cols': 30})) 9 | 10 | 11 | 12 | 13 | class AdminSigupForm(forms.ModelForm): 14 | class Meta: 15 | model=User 16 | fields=['first_name','last_name','username','password'] 17 | 18 | 19 | 20 | class StudentUserForm(forms.ModelForm): 21 | class Meta: 22 | model=User 23 | fields=['first_name','last_name','username','password'] 24 | 25 | class StudentExtraForm(forms.ModelForm): 26 | class Meta: 27 | model=models.StudentExtra 28 | fields=['enrollment','branch'] 29 | 30 | class BookForm(forms.ModelForm): 31 | class Meta: 32 | model=models.Book 33 | fields=['name','isbn','author','category'] 34 | class IssuedBookForm(forms.Form): 35 | #to_field_name value will be stored when form is submitted.....__str__ method of book model will be shown there in html 36 | isbn2=forms.ModelChoiceField(queryset=models.Book.objects.all(),empty_label="Name and isbn", to_field_name="isbn",label='Name and Isbn') 37 | enrollment2=forms.ModelChoiceField(queryset=models.StudentExtra.objects.all(),empty_label="Name and enrollment",to_field_name='enrollment',label='Name and enrollment') 38 | 39 | -------------------------------------------------------------------------------- /library/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-05 02:57 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='StudentExtra', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('enrollment', models.CharField(max_length=20)), 22 | ('branch', models.CharField(max_length=20)), 23 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /library/migrations/0002_book.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-05 14:35 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('library', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Book', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=30)), 18 | ('isbn', models.PositiveIntegerField()), 19 | ('author', models.CharField(max_length=40)), 20 | ('category', models.CharField(choices=[('education', 'Education'), ('entertainment', 'Entertainment'), ('comics', 'Comics'), ('biography', 'Biographie'), ('history', 'History')], default='education', max_length=30)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /library/migrations/0003_issuedbook.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-06 05:21 2 | 3 | from django.db import migrations, models 4 | import library.models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('library', '0002_book'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='IssuedBook', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('enrollment', models.CharField(choices=[('sdd323', 'sdd323 >'), ('qq', 'qq >'), ('ee', 'ee >'), ('x', 'x >'), ('x', 'x >'), ('q', 'q >')], max_length=20)), 19 | ('isbn', models.CharField(choices=[(123, 123), (1233, 1233), (1222, 1222)], max_length=20)), 20 | ('issuedate', models.DateField(auto_now=True)), 21 | ('expirydate', models.DateField(default=library.models.get_expiry)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /library/migrations/0004_auto_20200406_1053.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-06 05:23 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('library', '0003_issuedbook'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='issuedbook', 15 | name='enrollment', 16 | field=models.CharField(choices=[('sdd323', '> sdd323'), ('qq', '> qq'), ('ee', '> ee'), ('x', '> x'), ('x', '> x'), ('q', '> q')], max_length=20), 17 | ), 18 | migrations.AlterField( 19 | model_name='issuedbook', 20 | name='isbn', 21 | field=models.CharField(choices=[(123, 'rs 123'), (1233, 's chand 1233'), (1222, 'apti 1222')], max_length=20), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /library/migrations/0005_auto_20200407_0839.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-07 03:09 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('library', '0004_auto_20200406_1053'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='issuedbook', 15 | name='enrollment', 16 | field=models.CharField(choices=[('sdd323', 'subhi [sdd323]'), ('qq', 'sunita [qq]'), ('ee', 'sboot [ee]'), ('x', 'x [x]'), ('x', 'mloc [x]'), ('q', 'w [q]')], max_length=20), 17 | ), 18 | migrations.AlterField( 19 | model_name='issuedbook', 20 | name='isbn', 21 | field=models.CharField(choices=[('123', 'rs [123]'), ('1233', 's chand [1233]'), ('1222', 'apti [1222]'), ('12338', 'j [12338]')], max_length=20), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /library/migrations/0006_auto_20200409_1651.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-09 11:21 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('library', '0005_auto_20200407_0839'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='issuedbook', 15 | name='enrollment', 16 | field=models.CharField(choices=[], max_length=30), 17 | ), 18 | migrations.AlterField( 19 | model_name='issuedbook', 20 | name='isbn', 21 | field=models.CharField(choices=[('323', 'aptitude [323]'), ('767', 'java [767]'), ('678', 'chacha chaudhry [678]'), ('765', 'c++ [765]'), ('909', 'Python [909]'), ('34567', 'html [34567]')], max_length=30), 22 | ), 23 | migrations.AlterField( 24 | model_name='studentextra', 25 | name='branch', 26 | field=models.CharField(max_length=40), 27 | ), 28 | migrations.AlterField( 29 | model_name='studentextra', 30 | name='enrollment', 31 | field=models.CharField(max_length=40), 32 | ), 33 | ] 34 | -------------------------------------------------------------------------------- /library/migrations/0007_auto_20200412_1351.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-12 08:21 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('library', '0006_auto_20200409_1651'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='issuedbook', 15 | name='enrollment', 16 | ), 17 | migrations.RemoveField( 18 | model_name='issuedbook', 19 | name='isbn', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /library/migrations/0008_auto_20200412_1408.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-12 08:38 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('library', '0007_auto_20200412_1351'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='issuedbook', 15 | name='enrollment', 16 | field=models.CharField(default=1, max_length=30), 17 | preserve_default=False, 18 | ), 19 | migrations.AddField( 20 | model_name='issuedbook', 21 | name='isbn', 22 | field=models.CharField(default=1, max_length=30), 23 | preserve_default=False, 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /library/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__init__.py -------------------------------------------------------------------------------- /library/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0001_initial.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0001_initial.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0002_book.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0002_book.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0002_book.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0002_book.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0003_issuedbook.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0003_issuedbook.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0003_issuedbook.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0003_issuedbook.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0004_auto_20200406_1053.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0004_auto_20200406_1053.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0004_auto_20200406_1053.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0004_auto_20200406_1053.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0005_auto_20200407_0839.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0005_auto_20200407_0839.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0005_auto_20200407_0839.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0005_auto_20200407_0839.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0006_auto_20200409_1651.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0006_auto_20200409_1651.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0006_auto_20200409_1651.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0006_auto_20200409_1651.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0007_auto_20200412_1351.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0007_auto_20200412_1351.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0007_auto_20200412_1351.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0007_auto_20200412_1351.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0008_auto_20200412_1408.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0008_auto_20200412_1408.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/0008_auto_20200412_1408.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/0008_auto_20200412_1408.cpython-38.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /library/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/library/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /library/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | from datetime import datetime,timedelta 4 | 5 | 6 | 7 | class StudentExtra(models.Model): 8 | user=models.OneToOneField(User,on_delete=models.CASCADE) 9 | enrollment = models.CharField(max_length=40) 10 | branch = models.CharField(max_length=40) 11 | #used in issue book 12 | def __str__(self): 13 | return self.user.first_name+'['+str(self.enrollment)+']' 14 | @property 15 | def get_name(self): 16 | return self.user.first_name 17 | @property 18 | def getuserid(self): 19 | return self.user.id 20 | 21 | 22 | class Book(models.Model): 23 | catchoice= [ 24 | ('education', 'Education'), 25 | ('entertainment', 'Entertainment'), 26 | ('comics', 'Comics'), 27 | ('biography', 'Biographie'), 28 | ('history', 'History'), 29 | ] 30 | name=models.CharField(max_length=30) 31 | isbn=models.PositiveIntegerField() 32 | author=models.CharField(max_length=40) 33 | category=models.CharField(max_length=30,choices=catchoice,default='education') 34 | def __str__(self): 35 | return str(self.name)+"["+str(self.isbn)+']' 36 | 37 | 38 | def get_expiry(): 39 | return datetime.today() + timedelta(days=15) 40 | class IssuedBook(models.Model): 41 | #moved this in forms.py 42 | #enrollment=[(student.enrollment,str(student.get_name)+' ['+str(student.enrollment)+']') for student in StudentExtra.objects.all()] 43 | enrollment=models.CharField(max_length=30) 44 | #isbn=[(str(book.isbn),book.name+' ['+str(book.isbn)+']') for book in Book.objects.all()] 45 | isbn=models.CharField(max_length=30) 46 | issuedate=models.DateField(auto_now=True) 47 | expirydate=models.DateField(default=get_expiry) 48 | def __str__(self): 49 | return self.enrollment 50 | -------------------------------------------------------------------------------- /library/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /library/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.http import HttpResponseRedirect 3 | from . import forms,models 4 | from django.http import HttpResponseRedirect 5 | from django.contrib.auth.models import Group 6 | from django.contrib import auth 7 | from django.contrib.auth.decorators import login_required,user_passes_test 8 | from datetime import datetime,timedelta,date 9 | from django.core.mail import send_mail 10 | #from librarymanagement.settings import EMAIL_HOST_USER 11 | 12 | 13 | def home_view(request): 14 | if request.user.is_authenticated: 15 | return HttpResponseRedirect('afterlogin') 16 | return render(request,'library/index.html') 17 | 18 | #for showing signup/login button for student 19 | def studentclick_view(request): 20 | if request.user.is_authenticated: 21 | return HttpResponseRedirect('afterlogin') 22 | return render(request,'library/studentclick.html') 23 | 24 | #for showing signup/login button for teacher 25 | def adminclick_view(request): 26 | if request.user.is_authenticated: 27 | return HttpResponseRedirect('afterlogin') 28 | return render(request,'library/adminclick.html') 29 | 30 | 31 | 32 | def adminsignup_view(request): 33 | form=forms.AdminSigupForm() 34 | if request.method=='POST': 35 | form=forms.AdminSigupForm(request.POST) 36 | if form.is_valid(): 37 | user=form.save() 38 | user.set_password(user.password) 39 | user.save() 40 | 41 | 42 | my_admin_group = Group.objects.get_or_create(name='ADMIN') 43 | my_admin_group[0].user_set.add(user) 44 | 45 | return HttpResponseRedirect('adminlogin') 46 | return render(request,'library/adminsignup.html',{'form':form}) 47 | 48 | 49 | 50 | 51 | 52 | 53 | def studentsignup_view(request): 54 | form1=forms.StudentUserForm() 55 | form2=forms.StudentExtraForm() 56 | mydict={'form1':form1,'form2':form2} 57 | if request.method=='POST': 58 | form1=forms.StudentUserForm(request.POST) 59 | form2=forms.StudentExtraForm(request.POST) 60 | if form1.is_valid() and form2.is_valid(): 61 | user=form1.save() 62 | user.set_password(user.password) 63 | user.save() 64 | f2=form2.save(commit=False) 65 | f2.user=user 66 | user2=f2.save() 67 | 68 | my_student_group = Group.objects.get_or_create(name='STUDENT') 69 | my_student_group[0].user_set.add(user) 70 | 71 | return HttpResponseRedirect('studentlogin') 72 | return render(request,'library/studentsignup.html',context=mydict) 73 | 74 | 75 | 76 | 77 | def is_admin(user): 78 | return user.groups.filter(name='ADMIN').exists() 79 | 80 | def afterlogin_view(request): 81 | if is_admin(request.user): 82 | return render(request,'library/adminafterlogin.html') 83 | else: 84 | return render(request,'library/studentafterlogin.html') 85 | 86 | 87 | @login_required(login_url='adminlogin') 88 | @user_passes_test(is_admin) 89 | def addbook_view(request): 90 | #now it is empty book form for sending to html 91 | form=forms.BookForm() 92 | if request.method=='POST': 93 | #now this form have data from html 94 | form=forms.BookForm(request.POST) 95 | if form.is_valid(): 96 | user=form.save() 97 | return render(request,'library/bookadded.html') 98 | return render(request,'library/addbook.html',{'form':form}) 99 | 100 | @login_required(login_url='adminlogin') 101 | @user_passes_test(is_admin) 102 | def viewbook_view(request): 103 | books=models.Book.objects.all() 104 | return render(request,'library/viewbook.html',{'books':books}) 105 | 106 | 107 | 108 | 109 | @login_required(login_url='adminlogin') 110 | @user_passes_test(is_admin) 111 | def issuebook_view(request): 112 | form=forms.IssuedBookForm() 113 | if request.method=='POST': 114 | #now this form have data from html 115 | form=forms.IssuedBookForm(request.POST) 116 | if form.is_valid(): 117 | obj=models.IssuedBook() 118 | obj.enrollment=request.POST.get('enrollment2') 119 | obj.isbn=request.POST.get('isbn2') 120 | obj.save() 121 | return render(request,'library/bookissued.html') 122 | return render(request,'library/issuebook.html',{'form':form}) 123 | 124 | 125 | @login_required(login_url='adminlogin') 126 | @user_passes_test(is_admin) 127 | def viewissuedbook_view(request): 128 | issuedbooks=models.IssuedBook.objects.all() 129 | li=[] 130 | for ib in issuedbooks: 131 | issdate=str(ib.issuedate.day)+'-'+str(ib.issuedate.month)+'-'+str(ib.issuedate.year) 132 | expdate=str(ib.expirydate.day)+'-'+str(ib.expirydate.month)+'-'+str(ib.expirydate.year) 133 | #fine calculation 134 | days=(date.today()-ib.issuedate) 135 | print(date.today()) 136 | d=days.days 137 | fine=0 138 | if d>15: 139 | day=d-15 140 | fine=day*10 141 | 142 | 143 | books=list(models.Book.objects.filter(isbn=ib.isbn)) 144 | students=list(models.StudentExtra.objects.filter(enrollment=ib.enrollment)) 145 | i=0 146 | for l in books: 147 | t=(students[i].get_name,students[i].enrollment,books[i].name,books[i].author,issdate,expdate,fine) 148 | i=i+1 149 | li.append(t) 150 | 151 | return render(request,'library/viewissuedbook.html',{'li':li}) 152 | 153 | @login_required(login_url='adminlogin') 154 | @user_passes_test(is_admin) 155 | def viewstudent_view(request): 156 | students=models.StudentExtra.objects.all() 157 | return render(request,'library/viewstudent.html',{'students':students}) 158 | 159 | 160 | @login_required(login_url='studentlogin') 161 | def viewissuedbookbystudent(request): 162 | student=models.StudentExtra.objects.filter(user_id=request.user.id) 163 | issuedbook=models.IssuedBook.objects.filter(enrollment=student[0].enrollment) 164 | 165 | li1=[] 166 | 167 | li2=[] 168 | for ib in issuedbook: 169 | books=models.Book.objects.filter(isbn=ib.isbn) 170 | for book in books: 171 | t=(request.user,student[0].enrollment,student[0].branch,book.name,book.author) 172 | li1.append(t) 173 | issdate=str(ib.issuedate.day)+'-'+str(ib.issuedate.month)+'-'+str(ib.issuedate.year) 174 | expdate=str(ib.expirydate.day)+'-'+str(ib.expirydate.month)+'-'+str(ib.expirydate.year) 175 | #fine calculation 176 | days=(date.today()-ib.issuedate) 177 | print(date.today()) 178 | d=days.days 179 | fine=0 180 | if d>15: 181 | day=d-15 182 | fine=day*10 183 | t=(issdate,expdate,fine) 184 | li2.append(t) 185 | 186 | return render(request,'library/viewissuedbookbystudent.html',{'li1':li1,'li2':li2}) 187 | 188 | def aboutus_view(request): 189 | return render(request,'library/aboutus.html') 190 | 191 | def contactus_view(request): 192 | sub = forms.ContactusForm() 193 | if request.method == 'POST': 194 | sub = forms.ContactusForm(request.POST) 195 | if sub.is_valid(): 196 | email = sub.cleaned_data['Email'] 197 | name=sub.cleaned_data['Name'] 198 | message = sub.cleaned_data['Message'] 199 | send_mail(str(name)+' || '+str(email),message, EMAIL_HOST_USER, ['wapka1503@gmail.com'], fail_silently = False) 200 | return render(request, 'library/contactussuccess.html') 201 | return render(request, 'library/contactus.html', {'form':sub}) 202 | -------------------------------------------------------------------------------- /librarymanagement/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__init__.py -------------------------------------------------------------------------------- /librarymanagement/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/settings.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/settings.cpython-38.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /librarymanagement/__pycache__/wsgi.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/librarymanagement/__pycache__/wsgi.cpython-38.pyc -------------------------------------------------------------------------------- /librarymanagement/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for librarymanagement project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'librarymanagement.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /librarymanagement/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for librarymanagement project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.0.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | TEMPLATE_DIR = os.path.join(BASE_DIR,'templates') 18 | STATIC_DIR=os.path.join(BASE_DIR,'static') 19 | 20 | # Quick-start development settings - unsuitable for production 21 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 22 | 23 | # SECURITY WARNING: keep the secret key used in production secret! 24 | SECRET_KEY = 'k(6-_4sgig$sbrccr2*0=7s)bklpiywi#_121l)s(f8)dq^^wv' 25 | 26 | # SECURITY WARNING: don't run with debug turned on in production! 27 | DEBUG = True 28 | 29 | ALLOWED_HOSTS = [] 30 | 31 | 32 | # Application definition 33 | 34 | INSTALLED_APPS = [ 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | 'library', 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.middleware.common.CommonMiddleware', 48 | 'django.middleware.csrf.CsrfViewMiddleware', 49 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 | 'django.contrib.messages.middleware.MessageMiddleware', 51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 | ] 53 | 54 | ROOT_URLCONF = 'librarymanagement.urls' 55 | 56 | TEMPLATES = [ 57 | { 58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 59 | 'DIRS': [TEMPLATE_DIR,], 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'librarymanagement.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.sqlite3', 81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 82 | } 83 | } 84 | 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 92 | }, 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 101 | }, 102 | ] 103 | 104 | 105 | # Internationalization 106 | # https://docs.djangoproject.com/en/3.0/topics/i18n/ 107 | 108 | LANGUAGE_CODE = 'en-us' 109 | 110 | TIME_ZONE = 'UTC' 111 | 112 | USE_I18N = True 113 | 114 | USE_L10N = True 115 | 116 | USE_TZ = True 117 | 118 | 119 | # Static files (CSS, JavaScript, Images) 120 | # https://docs.djangoproject.com/en/3.0/howto/static-files/ 121 | 122 | STATIC_URL = '/static/' 123 | STATICFILES_DIRS=[ 124 | STATIC_DIR, 125 | ] 126 | 127 | LOGIN_REDIRECT_URL='/afterlogin' 128 | 129 | #for email 130 | EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend' 131 | EMAIL_HOST = 'smtp.gmail.com' 132 | EMAIL_USE_TLS = True 133 | EMAIL_PORT = 587 134 | # EMAIL_HOST_USER = 'your email ' 135 | # EMAIL_HOST_PASSWORD = 'your password' 136 | -------------------------------------------------------------------------------- /librarymanagement/urls.py: -------------------------------------------------------------------------------- 1 | """librarymanagement URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.conf.urls import include 18 | from django.urls import path 19 | from library import views 20 | from django.contrib.auth.views import LoginView,LogoutView 21 | 22 | 23 | 24 | urlpatterns = [ 25 | path('admin/', admin.site.urls), 26 | path('accounts/',include('django.contrib.auth.urls') ), 27 | path('', views.home_view), 28 | 29 | path('adminclick', views.adminclick_view), 30 | path('studentclick', views.studentclick_view), 31 | 32 | 33 | path('adminsignup', views.adminsignup_view), 34 | path('studentsignup', views.studentsignup_view), 35 | path('adminlogin', LoginView.as_view(template_name='library/adminlogin.html')), 36 | path('studentlogin', LoginView.as_view(template_name='library/studentlogin.html')), 37 | 38 | path('logout', LogoutView.as_view(template_name='library/index.html')), 39 | path('afterlogin', views.afterlogin_view), 40 | 41 | path('addbook', views.addbook_view), 42 | path('viewbook', views.viewbook_view), 43 | path('issuebook', views.issuebook_view), 44 | path('viewissuedbook', views.viewissuedbook_view), 45 | path('viewstudent', views.viewstudent_view), 46 | path('viewissuedbookbystudent', views.viewissuedbookbystudent), 47 | 48 | path('aboutus', views.aboutus_view), 49 | path('contactus', views.contactus_view), 50 | 51 | ] 52 | -------------------------------------------------------------------------------- /librarymanagement/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for librarymanagement project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'librarymanagement.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'librarymanagement.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.2.7 2 | Django==3.0.5 3 | django-widget-tweaks==1.4.8 4 | pytz==2020.1 5 | sqlparse==0.3.1 6 | 7 | -------------------------------------------------------------------------------- /static/images/Admin-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/images/Admin-icon.png -------------------------------------------------------------------------------- /static/images/lib1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/images/lib1.png -------------------------------------------------------------------------------- /static/images/lib2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/images/lib2.jpg -------------------------------------------------------------------------------- /static/images/lib3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/images/lib3.webp -------------------------------------------------------------------------------- /static/images/student.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/images/student.png -------------------------------------------------------------------------------- /static/screenshots/adminhomepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/screenshots/adminhomepage.png -------------------------------------------------------------------------------- /static/screenshots/availablebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/screenshots/availablebook.png -------------------------------------------------------------------------------- /static/screenshots/bookissued.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/screenshots/bookissued.png -------------------------------------------------------------------------------- /static/screenshots/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/screenshots/homepage.png -------------------------------------------------------------------------------- /static/screenshots/issuebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BurhanMohammad/Django-librarymanagement/69b659b05c2bd1a8429a425b9c845d46d6dacdbf/static/screenshots/issuebook.png -------------------------------------------------------------------------------- /templates/library/aboutus.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | MOhammad Burhan 14 | 26 | 27 | 28 | 29 | 30 | 31 | {% include "library/navbar.html" %} 32 |

33 |

About Us !

34 |
35 |

Hello, Reader!

36 |

A service dedicated to Admin and Student. We provide online resources, professional support 37 | and guidance to all our students whenever, and from wherever they have chosen to study.

38 |
39 |

Explore our Website.

40 |

41 | HOME 42 |

43 |
44 | 45 | {% include "library/footer.html" %} 46 | 47 | 48 | -------------------------------------------------------------------------------- /templates/library/addbook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mohammad burhan 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {% include "library/navbaradmin.html" %} 98 |
99 |
100 |

ADD BOOK IN LIBRARY !

101 | 126 | 127 | 128 | 129 | 130 | {% include "library/footer.html" %} 131 | 132 | 133 | -------------------------------------------------------------------------------- /templates/library/adminafterlogin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 34 | 35 | 36 | {% include "library/navbaradmin.html" %} 37 |
38 |
39 |

Welcome to Online library !

40 |
41 |

Hello {{user.first_name}} !

42 |

As you are Admin, you can add a book to library, view available book in library, 43 | Issue books to students, 44 | View issued book to students and many more ... ! 45 | 46 |

47 |
48 |

Option Available For You

49 | 56 | 57 |
58 | 59 | 60 | {% include "library/footer.html" %} 61 | 62 | 63 | -------------------------------------------------------------------------------- /templates/library/adminclick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Admin 7 | 8 | 9 | 10 | 11 | 12 | 13 | 21 | 22 | 23 | {% include "library/navbar.html" %} 24 |

25 |
26 |

Hello, Admin

27 |

Welcome to Online Library Management System.

28 |
29 |

You can access various features after Login/SignUp.

30 |

31 | SignUp 32 | Login 33 |

34 |
35 | 36 | {% include "library/footer.html" %} 37 | 38 | 39 | -------------------------------------------------------------------------------- /templates/library/adminlogin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mohammad Burhan 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {% include "library/navbar.html" %} 98 |
99 |
100 |

Login As Admin!

101 | 124 | 125 | 126 | 127 | {% include "library/footer.html" %} 128 | 129 | 130 | -------------------------------------------------------------------------------- /templates/library/adminsignup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mohammad Burhan 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | {% include "library/navbar.html" %} 106 |
107 |
108 |

Signup As Admin!

109 | 132 | 133 | 134 | 135 | {% include "library/footer.html" %} 136 | 137 | 138 | -------------------------------------------------------------------------------- /templates/library/bookadded.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {% include "library/navbaradmin.html" %} 8 |
9 |
10 | 11 |

Book Added Successfully !

12 |

13 | 20 |
21 | {% include "library/footer.html" %} 22 | 23 | 24 | -------------------------------------------------------------------------------- /templates/library/bookissued.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {% include "library/navbaradmin.html" %} 8 |
9 |
10 | 11 |

Book Issued Successfully !

12 |

13 | 18 |
19 | {% include "library/footer.html" %} 20 | 21 | 22 | -------------------------------------------------------------------------------- /templates/library/contactus.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Mohammad Burhan 16 | 17 | 18 | 19 | 20 | 21 | {% include "library/navbar.html" %} 22 |

23 | 24 |
25 |

Send Us Your Valuable Feedback !

26 | 27 |
28 | 29 | {% csrf_token %} 30 |
31 |

32 |

{{ form.as_p }}

33 |

34 |
35 | 36 |
37 |
38 |
39 | {% include "library/footer.html" %} 40 | 41 | 42 | -------------------------------------------------------------------------------- /templates/library/contactussuccess.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Mohammad Burhan 16 | 24 | 25 | 26 | 27 | 28 | {% include "library/navbar.html" %} 29 |

30 |
31 |

Your message sent successfully !

32 |

We will respond to your feedback soon

33 |
34 |

Check other features of website !

35 |

36 | HOME 37 |

38 |
39 | 40 | {% include "library/footer.html" %} 41 | 42 | 43 | -------------------------------------------------------------------------------- /templates/library/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 55 | 56 | 57 |
58 | 59 |

60 | 61 | 62 | 63 | 64 |

65 | 66 |
67 |
68 |
69 |
70 | 74 |
75 |
76 |
77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /templates/library/index.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | Library Management System 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | {% include "library/navbar.html" %} 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 |
85 |

Hello, Reader!

86 |

A service dedicated to Admin and Student. We provide online resources, professional support 87 | and guidance to all our students whenever, and from wherever they have chosen to study.

88 |
89 | 90 |
91 | 92 |
93 |

94 | Admin 95 | 96 |
97 | 98 |
99 |

100 | Student 101 |
102 |
103 |
104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | {% include "library/footer.html" %} 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /templates/library/issuebook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mohammad Burhan 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {% include "library/navbaradmin.html" %} 98 |
99 |
100 |

ISSUE BOOK TO STUDENT !

101 | 126 | 127 | 128 | 129 | 130 | {% include "library/footer.html" %} 131 | 132 | 133 | -------------------------------------------------------------------------------- /templates/library/navbar.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 51 |
52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /templates/library/navbaradmin.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | Navbar with Dropdown and Search Form 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | 85 |
86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /templates/library/navbarstudent.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | Navbar with Dropdown and Search Form 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | 68 |
69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /templates/library/registration/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | {{form.as_p}} 10 | {% csrf_token %} 11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /templates/library/studentafterlogin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 34 | 35 | 36 | {% include "library/navbarstudent.html" %} 37 |
38 |
39 |

Welcome to Online library !

40 |
41 |

Hello {{user.first_name}} !

42 |

As you are Student, you can see how many book you have taken from library with fine and many more ...! 43 |

44 |
45 |

Option Available For You

46 | 49 | 50 |
51 | 52 | 53 | {% include "library/footer.html" %} 54 | 55 | 56 | -------------------------------------------------------------------------------- /templates/library/studentclick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Mohammad Burhan 14 | 22 | 23 | 24 | 25 | {% include "library/navbar.html" %} 26 |

27 |
28 |

Hello, Student

29 |

Welcome to Online Library Management System.

30 |
31 |

You can access various features after Login.

32 |

33 | SignUp 34 | Login 35 |

36 |
37 | 38 | 39 | {% include "library/footer.html" %} 40 | 41 | 42 | -------------------------------------------------------------------------------- /templates/library/studentlogin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mohammad Burhan 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | {% include "library/navbar.html" %} 106 |
107 |
108 |

Login As Student!

109 | 132 | 133 | 134 | 135 | {% include "library/footer.html" %} 136 | 137 | 138 | -------------------------------------------------------------------------------- /templates/library/studentsignup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mohammad Burhan 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | {% include "library/navbar.html" %} 106 |
107 |
108 |

Signup As Student!

109 | 141 | 142 | 143 | 144 | 145 | {% include "library/footer.html" %} 146 | 147 | 148 | -------------------------------------------------------------------------------- /templates/library/viewbook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 56 | 57 | 58 | {% include "library/navbaradmin.html" %} 59 |
60 |
61 |

Available Book in Library !

62 | {% if books%} 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 77 | 78 | 79 | 80 | {% for book in books %} 81 | 82 | 83 | 84 | 85 | 86 | 87 | {% endfor %} 88 | 89 |
Book NameISBNAuthorCategory
75 | 76 |
{{book.name}}{{book.isbn}}{{book.author}}{{book.category}}
90 | {%else%} 91 |

Have 0 book

92 | {%endif%} 93 | 94 | 95 |








96 | {% include "library/footer.html" %} 97 | 98 | 99 | -------------------------------------------------------------------------------- /templates/library/viewissuedbook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 58 | 59 | 60 | {% include "library/navbaradmin.html" %} 61 |
62 |
63 |

Issued books to Student !

64 | 65 | {% if li%} 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | 85 | 86 | {% for t in li %} 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | {%endfor%} 97 | 98 |
Student NameStudent EnrollmentBook NameBook AuthorIssue DateExpiry DateFine
81 | 82 |
{{t.0}}{{t.1}}{{t.2}}{{t.3}}{{t.4}}{{t.5}}{{t.6}}
99 | {%else%} 100 |

0 book Issued

101 | {%endif%} 102 | 103 |








104 | {% include "library/footer.html" %} 105 | 106 | 107 | -------------------------------------------------------------------------------- /templates/library/viewissuedbookbystudent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 60 | 61 | 62 | 63 | {% include "library/navbarstudent.html" %}

64 |

Book Issued To You !

65 | 66 |
67 | 68 |
69 | {% if li1%} 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 85 | 86 | 87 | 88 | {% for t in li1 %} 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {% endfor %} 98 | 99 |
NameEnrollmentBranchBook NameBook Author
83 | 84 |
{{t.0}} {{t.1}} {{t.2}} {{t.3}} {{t.4}}
100 | 101 |
102 | 103 |
104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 118 | 119 | 120 | 121 | {% for t in li2 %} 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | {% endfor %} 132 | 133 |
Issue DateExpiry DateFine
116 | 117 |
{{t.0}} {{t.1}} {{t.2}}
134 | {%else%} 135 |

No book Issued to you

136 | {%endif%} 137 | 138 |
139 | 140 | 141 | 142 | 143 | 144 | 145 |





146 |


147 | {% include "library/footer.html" %} 148 | 149 | 150 | -------------------------------------------------------------------------------- /templates/library/viewstudent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 59 | 60 | 61 | {% include "library/navbaradmin.html" %} 62 |
63 |
64 |

Student registered in Library !

65 | 66 | {% if students%} 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 81 | 82 | 83 | {% for s in students %} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | {% endfor %} 92 | 93 |
NameEnrollmentBranch
78 | 79 |
{{s.get_name}}{{s.enrollment}}{{s.branch}}
94 | {%else%} 95 |

No Student Registered in Library

96 | {%endif%} 97 | 98 | 99 | 100 |





101 | 102 |


103 | {% include "library/footer.html" %} 104 | 105 | 106 | -------------------------------------------------------------------------------- /templates/registration/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | {{form.as_p}} 10 | {% csrf_token %} 11 | 12 |
13 | 14 | 15 | --------------------------------------------------------------------------------