├── Django Rest Framework ├── bookstore_management │ ├── backend │ │ └── bookstore │ │ │ ├── api │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-39.pyc │ │ │ │ ├── admin.cpython-39.pyc │ │ │ │ ├── apps.cpython-39.pyc │ │ │ │ ├── models.cpython-39.pyc │ │ │ │ ├── serializers.cpython-39.pyc │ │ │ │ ├── urls.cpython-39.pyc │ │ │ │ └── views.cpython-39.pyc │ │ │ ├── admin.py │ │ │ ├── apps.py │ │ │ ├── migrations │ │ │ │ ├── 0001_initial.py │ │ │ │ ├── __init__.py │ │ │ │ └── __pycache__ │ │ │ │ │ ├── 0001_initial.cpython-39.pyc │ │ │ │ │ └── __init__.cpython-39.pyc │ │ │ ├── models.py │ │ │ ├── serializers.py │ │ │ ├── tests.py │ │ │ ├── urls.py │ │ │ └── views.py │ │ │ ├── bookstore │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-39.pyc │ │ │ │ ├── settings.cpython-39.pyc │ │ │ │ ├── urls.cpython-39.pyc │ │ │ │ └── wsgi.cpython-39.pyc │ │ │ ├── asgi.py │ │ │ ├── settings.py │ │ │ ├── urls.py │ │ │ └── wsgi.py │ │ │ ├── db.sqlite3 │ │ │ └── manage.py │ └── frontend │ │ └── index.html └── drf_2 │ ├── db.sqlite3 │ ├── drf_2 │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py │ ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── paginations.cpython-39.pyc │ │ ├── permissions.cpython-39.pyc │ │ ├── serializers.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ ├── 0001_initial.cpython-39.pyc │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── paginations.py │ ├── permissions.py │ ├── serializers.py │ ├── tests.py │ ├── urls.py │ └── views.py │ ├── manage.py │ └── user_app │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-39.pyc │ ├── admin.cpython-39.pyc │ ├── apps.cpython-39.pyc │ ├── models.cpython-39.pyc │ ├── serializers.cpython-39.pyc │ ├── signals.cpython-39.pyc │ ├── urls.cpython-39.pyc │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ ├── __init__.py │ └── __pycache__ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── serializers.py │ ├── signals.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── Final_Project ├── Part-1.zip ├── Part-2.zip ├── Part-3.zip └── Part-4.zip ├── eighth_project ├── .vscode │ └── settings.json ├── db.sqlite3 ├── eighth_project │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── forms.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ ├── base.html │ │ ├── home.html │ │ ├── login.html │ │ ├── passchange.html │ │ ├── profile.html │ │ └── signup.html │ ├── tests.py │ ├── urls.py │ └── views.py └── manage.py ├── fifth_project ├── db.sqlite3 ├── fifth_project │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ ├── views.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── forms.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ └── first_app │ │ │ ├── about.html │ │ │ ├── django_form.html │ │ │ ├── form.html │ │ │ └── home.html │ ├── tests.py │ ├── upload │ │ ├── 2.pdf │ │ └── Abdullah-All-Naim.png │ ├── urls.py │ └── views.py ├── manage.py └── templates │ └── base.html ├── first_project ├── db.sqlite3 ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── first_project │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ ├── views.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ ├── views.py │ └── wsgi.py └── manage.py ├── fourth_project ├── db.sqlite3 ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ └── first_app │ │ │ ├── about.html │ │ │ ├── courses.html │ │ │ └── home.html │ ├── templatetags │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-39.pyc │ │ │ └── first_tags.cpython-39.pyc │ │ └── first_tags.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── fourth_project │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py └── templates │ └── base.html ├── mamar_bank ├── accounts │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── constants.cpython-39.pyc │ │ ├── forms.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── constants.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ ├── 0001_initial.cpython-39.pyc │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ └── accounts │ │ │ ├── profile.html │ │ │ ├── user_login.html │ │ │ └── user_registration.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── core │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── static │ │ └── img │ │ │ └── bank.jpg │ ├── templates │ │ ├── base.html │ │ ├── footer.html │ │ ├── index.html │ │ ├── messages.html │ │ └── navbar.html │ ├── tests.py │ └── views.py ├── db.sqlite3 ├── mamar_bank │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py └── transactions │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-39.pyc │ ├── admin.cpython-39.pyc │ ├── apps.cpython-39.pyc │ ├── constants.cpython-39.pyc │ ├── forms.cpython-39.pyc │ ├── models.cpython-39.pyc │ ├── urls.cpython-39.pyc │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── constants.py │ ├── forms.py │ ├── migrations │ ├── 0001_initial.py │ ├── __init__.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-39.pyc │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ └── transactions │ │ ├── loan_request.html │ │ ├── transaction_form.html │ │ └── transaction_report.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── ninth_project ├── db.sqlite3 ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ ├── del.html │ │ ├── get_cookie.html │ │ ├── get_session.html │ │ └── home.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── manage.py └── ninth_project │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-39.pyc │ ├── settings.cpython-39.pyc │ ├── urls.cpython-39.pyc │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── second_project ├── db.sqlite3 ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ └── first_app │ │ │ └── index.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── manage.py ├── second_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── second_project │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── settings.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ ├── views.cpython-39.pyc │ │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ ├── views.py │ └── wsgi.py └── templates │ └── index.html ├── seventh_project ├── db.sqlite3 ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── forms.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_bankmanagement.py │ │ ├── 0003_studentinfomodel_teacherinfomodel_and_more.py │ │ ├── 0004_employeemodel_managermodel.py │ │ ├── 0005_friend_me.py │ │ ├── 0006_person_alter_me_options_passport.py │ │ ├── 0007_post.py │ │ ├── 0008_student_teacher.py │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ ├── 0001_initial.cpython-39.pyc │ │ │ ├── 0002_bankmanagement.cpython-39.pyc │ │ │ ├── 0003_studentinfomodel_teacherinfomodel_and_more.cpython-39.pyc │ │ │ ├── 0004_employeemodel_managermodel.cpython-39.pyc │ │ │ ├── 0005_friend_me.cpython-39.pyc │ │ │ ├── 0006_person_alter_me_options_passport.cpython-39.pyc │ │ │ ├── 0007_post.cpython-39.pyc │ │ │ ├── 0008_student_teacher.cpython-39.pyc │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ ├── home.html │ │ └── show_data.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── manage.py └── seventh_project │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-39.pyc │ ├── settings.cpython-39.pyc │ ├── urls.cpython-39.pyc │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── sixth_project ├── db.sqlite3 ├── first_app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-39.pyc │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ └── views.cpython-39.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_student_father_name.py │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ ├── 0001_initial.cpython-39.pyc │ │ │ ├── 0002_student_father_name.cpython-39.pyc │ │ │ └── __init__.cpython-39.pyc │ ├── models.py │ ├── templates │ │ └── home.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── manage.py └── sixth_project │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-39.pyc │ ├── settings.cpython-39.pyc │ ├── urls.cpython-39.pyc │ └── wsgi.cpython-39.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── third_project ├── db.sqlite3 ├── first_app ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-39.pyc │ ├── admin.cpython-39.pyc │ ├── apps.cpython-39.pyc │ ├── models.cpython-39.pyc │ ├── urls.cpython-39.pyc │ └── views.cpython-39.pyc ├── admin.py ├── apps.py ├── migrations │ ├── __init__.py │ └── __pycache__ │ │ └── __init__.cpython-39.pyc ├── models.py ├── static │ └── first_app │ │ ├── css │ │ └── first.css │ │ ├── images │ │ ├── image1.jpg │ │ └── img2.jpg │ │ └── js │ │ └── index.js ├── templates │ └── first_app │ │ └── index.html ├── tests.py ├── urls.py └── views.py ├── manage.py ├── static ├── css │ └── first.css ├── images │ ├── bird.jpg │ └── image1.jpg └── js │ └── index.js ├── templates └── index.html └── third_project ├── __init__.py ├── __pycache__ ├── __init__.cpython-39.pyc ├── settings.cpython-39.pyc ├── urls.cpython-39.pyc ├── views.cpython-39.pyc └── wsgi.cpython-39.pyc ├── asgi.py ├── settings.py ├── urls.py ├── views.py └── wsgi.py /Django Rest Framework/bookstore_management/backend/bookstore/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/serializers.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/serializers.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ApiConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'api' 7 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2.4 on 2023-08-12 05:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='BookStoreModel', 16 | fields=[ 17 | ('id', models.IntegerField(primary_key=True, serialize=False)), 18 | ('book_name', models.CharField(max_length=30)), 19 | ('author', models.CharField(max_length=30)), 20 | ('category', models.CharField(choices=[('Mystery', 'Mystery'), ('Thriller', 'Thriller'), ('Sci-Fi', 'Sci-Fi'), ('Humor', 'Humor'), ('Horror', 'Horror')], max_length=30)), 21 | ('first_pub', models.DateTimeField(auto_now_add=True)), 22 | ('last_pub', models.DateTimeField(auto_now=True)), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/api/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | class BookStoreModel(models.Model): 6 | CATEGORY = ( 7 | ('Mystery', 'Mystery'), 8 | ('Thriller', 'Thriller'), 9 | ('Sci-Fi', 'Sci-Fi'), 10 | ('Humor', 'Humor'), 11 | ('Horror', 'Horror'), 12 | ) 13 | id = models.IntegerField(primary_key=True) 14 | book_name = models.CharField(max_length=30) 15 | author = models.CharField(max_length=30) 16 | category = models.CharField(max_length=30, choices=CATEGORY) 17 | first_pub = models.DateTimeField(auto_now_add=True) # django ekdom first date 18 | last_pub = models.DateTimeField(auto_now=True) # erpor joto update korbo sei date dekhabe -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | from .models import BookStoreModel 3 | 4 | class BookStoreSerializer(serializers.ModelSerializer): 5 | class Meta: 6 | model = BookStoreModel 7 | fields = '__all__' -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/api/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path, include 2 | from rest_framework.routers import DefaultRouter 3 | from . import views 4 | 5 | # Create a router and register our viewsets with it. 6 | router = DefaultRouter() 7 | router.register(r'books', views.BookViewSet,basename="book") 8 | 9 | # The API URLs are now determined automatically by the router. 10 | urlpatterns = [ 11 | # path('books/', views.BookListView.as_view()), # get, post request handle korbe 12 | # path('books//', views.BookListUpdateDelete.as_view()), # update, delete request handle korbe 13 | # path('books/', views.BookListCreateAPIView.as_view()), # get, post request handle korbe 14 | # path('books//', views.BookRetrieveUpdateDestroyAPIView.as_view()), # update, delete request handle korbe 15 | path('', include(router.urls)), 16 | ] -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/bookstore/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for bookstore 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/4.2/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', 'bookstore.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for bookstore project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('api/', include('api.urls')), 23 | ] 24 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/bookstore/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for bookstore 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/4.2/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', 'bookstore.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/bookstore_management/backend/bookstore/db.sqlite3 -------------------------------------------------------------------------------- /Django Rest Framework/bookstore_management/backend/bookstore/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookstore.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/db.sqlite3 -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/drf_2/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/drf_2/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/drf_2/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/drf_2/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/drf_2/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for drf_2 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/4.2/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', 'drf_2.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for drf_2 project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path,include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', include("first_app.urls")), 23 | path('account/', include("user_app.urls")), 24 | ] 25 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/drf_2/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for drf_2 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/4.2/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', 'drf_2.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/paginations.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/paginations.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/permissions.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/permissions.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/serializers.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/serializers.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from . import models 3 | 4 | # Register your models here. 5 | admin.site.register(models.Product) 6 | admin.site.register(models.ProductReview) 7 | 8 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-06-05 12:51 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='Product', 19 | fields=[ 20 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('name', models.CharField(max_length=200)), 22 | ('description', models.TextField()), 23 | ('price', models.DecimalField(decimal_places=2, max_digits=10)), 24 | ], 25 | ), 26 | migrations.CreateModel( 27 | name='ProductReview', 28 | fields=[ 29 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 30 | ('rating', models.IntegerField(choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)])), 31 | ('review', models.TextField()), 32 | ('created_at', models.DateTimeField(auto_now_add=True)), 33 | ('updated_at', models.DateTimeField(auto_now=True)), 34 | ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reviews', to='first_app.product')), 35 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 36 | ], 37 | ), 38 | ] 39 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | 4 | class Product(models.Model): 5 | name = models.CharField(max_length=200) 6 | description = models.TextField() 7 | price = models.DecimalField(max_digits=10, decimal_places=2) # 120.65 8 | def __str__(self): 9 | return self.name 10 | 11 | class ProductReview(models.Model): 12 | product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='reviews') 13 | user = models.ForeignKey(User, on_delete=models.CASCADE) 14 | rating = models.IntegerField(choices=[(i, i) for i in range(1, 6)]) 15 | review = models.TextField() 16 | created_at = models.DateTimeField(auto_now_add=True) # obj kkhn toiri hoiche setar time save korbe 17 | updated_at = models.DateTimeField(auto_now=True) # user jkhn review edit korbe tokhn time ta dekhabe 18 | class Meta: 19 | unique_together = ('product', 'user') # ekjon user jeno ektai comment korte pare sejonne ei line ta 20 | 21 | def __str__(self): 22 | return f"{self.user.username} - {self.product.name} - Rating: {self.rating}" 23 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/paginations.py: -------------------------------------------------------------------------------- 1 | from rest_framework.pagination import PageNumberPagination,LimitOffsetPagination,CursorPagination 2 | 3 | class ProductPagination(PageNumberPagination): 4 | page_size = 3 # total 10 ta content 5 | page_query_param ='p' 6 | page_size_query_param = 'size' 7 | max_page_size = 4 8 | 9 | class ProductLimitOffsetPagination(LimitOffsetPagination): 10 | default_limit = 2 11 | limit_query_param = 'l' 12 | offset_query_param ='start' 13 | max_limit = 3 14 | 15 | class ProductCursorPagination(CursorPagination): 16 | page_size = 3 17 | ordering = 'price' 18 | cursor_query_param ='data' -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/permissions.py: -------------------------------------------------------------------------------- 1 | from rest_framework import permissions 2 | class AdminOrReadOnly(permissions.IsAdminUser): 3 | def has_permission(self, request, view): 4 | if request.method in permissions.SAFE_METHODS: # get 5 | return True 6 | else: # put, delete, post 7 | bool(request.user and request.user.is_staff) 8 | 9 | class ReviewerOrReadOnly(permissions.BasePermission): 10 | def has_object_permission(self, request, view, obj): 11 | if request.method in permissions.SAFE_METHODS: # get 12 | return True 13 | else: 14 | return obj.user == request.user 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers, viewsets 2 | from .models import Product, ProductReview 3 | 4 | class ProductSerializer(serializers.ModelSerializer): 5 | reviews = serializers.StringRelatedField(many=True) 6 | class Meta: 7 | model = Product 8 | fields = '__all__' 9 | 10 | class ProductReviewSerializer(serializers.ModelSerializer): 11 | 12 | class Meta: 13 | model = ProductReview 14 | fields = '__all__' 15 | 16 | 17 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import include, path 2 | from rest_framework import routers 3 | from .views import ProductViewSet, ProductReviewViewSet 4 | 5 | router = routers.DefaultRouter() 6 | router.register('products', ProductViewSet, basename='product') 7 | router.register('reviews', ProductReviewViewSet, basename='product-review') 8 | 9 | urlpatterns = [ 10 | path('', include(router.urls)), 11 | # path('api_auth/', include('rest_framework.urls')), 12 | ] 13 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from rest_framework import viewsets 3 | from . import models, serializers 4 | from rest_framework.permissions import IsAuthenticated,IsAuthenticatedOrReadOnly 5 | from . import permissions 6 | from django_filters.rest_framework import DjangoFilterBackend 7 | from rest_framework import filters 8 | from . import paginations 9 | 10 | class ProductViewSet(viewsets.ModelViewSet): 11 | permission_classes = [permissions.AdminOrReadOnly] 12 | queryset = models.Product.objects.all() 13 | serializer_class = serializers.ProductSerializer 14 | # filter_backends = [filters.SearchFilter] 15 | # search_fields = ['name', 'description'] 16 | # filter_backends = [filters.OrderingFilter] 17 | # ordering_fields = ['price'] 18 | # pagination_class = paginations.ProductPagination 19 | # pagination_class = paginations.ProductLimitOffsetPagination 20 | pagination_class = paginations.ProductCursorPagination 21 | 22 | 23 | class ProductReviewViewSet(viewsets.ModelViewSet): 24 | permission_classes = [permissions.ReviewerOrReadOnly] 25 | queryset = models.ProductReview.objects.all() 26 | serializer_class = serializers.ProductReviewSerializer 27 | # filter_backends = [DjangoFilterBackend] 28 | # filterset_fields = ['rating', 'product'] 29 | filter_backends = [filters.OrderingFilter] 30 | ordering_fields = ['rating'] 31 | # def get_queryset(self): 32 | # queryset = models.ProductReview.objects.all() 33 | # username = self.request.query_params.get('username') 34 | # if username is not None: 35 | # queryset = queryset.filter(user__username__icontains=username) 36 | # return queryset -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drf_2.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/serializers.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/serializers.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/signals.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/signals.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class UserAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'user_app' 7 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/migrations/__init__.py -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Django Rest Framework/drf_2/user_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/serializers.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import User 2 | from rest_framework import serializers 3 | 4 | class RegistrationSerializer(serializers.ModelSerializer): 5 | password2 = serializers.CharField(style={"input_type":'password'}, write_only='True') 6 | class Meta: 7 | model = User 8 | fields = ['username', 'email', 'password', 'password2'] 9 | extra_kwargs = { 10 | 'password':{'write_only' : True} 11 | } 12 | def save(self): 13 | username = self.validated_data['username'] 14 | email = self.validated_data['email'] 15 | password = self.validated_data['password'] 16 | password2 = self.validated_data['password2'] 17 | 18 | if password != password2: 19 | raise serializers.ValidationError({'error': 'password does not matched'}) 20 | if User.objects.filter(email = email).exists(): 21 | raise serializers.ValidationError({'error': 'email already exists'}) 22 | account = User(username= username, email = email) 23 | account.set_password(password) 24 | account.save() 25 | return account 26 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/signals.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db.models.signals import post_save 3 | from django.dispatch import receiver 4 | from rest_framework.authtoken.models import Token 5 | 6 | @receiver(post_save, sender=settings.AUTH_USER_MODEL) 7 | def create_auth_token(sender, instance=None, created=False, **kwargs): 8 | if created: 9 | Token.objects.create(user=instance) -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path,include 2 | from rest_framework.authtoken.views import obtain_auth_token 3 | from . import views 4 | urlpatterns = [ 5 | path('login/', obtain_auth_token, name='login'), 6 | path('register/', views.RegistrationView.as_view(), name='register'), 7 | path('logout/', views.LogoutView.as_view(), name='logout'), 8 | ] 9 | -------------------------------------------------------------------------------- /Django Rest Framework/drf_2/user_app/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework import status 2 | from rest_framework.response import Response 3 | from rest_framework.views import APIView 4 | from .serializers import RegistrationSerializer 5 | from rest_framework.authtoken.models import Token 6 | from . import signals 7 | 8 | class RegistrationView(APIView): 9 | def post(self, request): 10 | data = {} 11 | serializer = RegistrationSerializer(data=request.data) 12 | if serializer.is_valid(): 13 | account = serializer.save() 14 | data['response'] = 'Registration Successful' 15 | data['username'] = account.username 16 | data['email'] = account.email 17 | token = Token.objects.get(user=account).key 18 | data['token'] = token 19 | 20 | else: 21 | data = serializer.errors 22 | return Response(data) 23 | 24 | 25 | class LogoutView(APIView): 26 | def post(self, request): 27 | request.user.auth_token.delete() 28 | return Response(status = status.HTTP_200_OK) 29 | -------------------------------------------------------------------------------- /Final_Project/Part-1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Final_Project/Part-1.zip -------------------------------------------------------------------------------- /Final_Project/Part-2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Final_Project/Part-2.zip -------------------------------------------------------------------------------- /Final_Project/Part-3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Final_Project/Part-3.zip -------------------------------------------------------------------------------- /Final_Project/Part-4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/Final_Project/Part-4.zip -------------------------------------------------------------------------------- /eighth_project/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[python]": { 3 | "editor.defaultFormatter": "ms-python.autopep8" 4 | }, 5 | "python.formatting.provider": "none" 6 | } 7 | -------------------------------------------------------------------------------- /eighth_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/db.sqlite3 -------------------------------------------------------------------------------- /eighth_project/eighth_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/eighth_project/__init__.py -------------------------------------------------------------------------------- /eighth_project/eighth_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/eighth_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/eighth_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/eighth_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/eighth_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/eighth_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/eighth_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/eighth_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/eighth_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for eighth_project 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/4.2/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', 'eighth_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /eighth_project/eighth_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for eighth_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', include('first_app.urls')), 23 | ] 24 | -------------------------------------------------------------------------------- /eighth_project/eighth_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for eighth_project 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/4.2/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', 'eighth_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /eighth_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__init__.py -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/forms.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/forms.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /eighth_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /eighth_project/first_app/forms.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import User 2 | from django.contrib.auth.forms import UserCreationForm, UserChangeForm 3 | from django import forms 4 | 5 | class RegisterForm(UserCreationForm): 6 | first_name = forms.CharField(widget=forms.TextInput(attrs={'id' : 'required'})) 7 | last_name = forms.CharField(widget=forms.TextInput(attrs={'id' : 'required'})) 8 | email = forms.CharField(widget=forms.EmailInput(attrs={'id' : 'required'})) 9 | class Meta: 10 | model = User 11 | fields = ['username', 'first_name', 'last_name', 'email'] 12 | 13 | class ChangeUserData(UserChangeForm): 14 | password = None 15 | class Meta: 16 | model = User 17 | fields = ['username', 'first_name', 'last_name', 'email'] 18 | -------------------------------------------------------------------------------- /eighth_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /eighth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/eighth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /eighth_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /eighth_project/first_app/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html'%} 2 | 3 | {% block body %} 4 | 5 |

Home page

6 |

{{my_argument}}

7 | {% endblock %} -------------------------------------------------------------------------------- /eighth_project/first_app/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html'%} 2 | {% load crispy_forms_tags %} 3 | {% block body %} 4 | 5 |
6 |

Login Page

7 | {% csrf_token %} 8 | {% if form.non_field_errors %} 9 | {% for er in form.non_field_errors %} 10 |

{{er}}

11 | {% endfor %} 12 | {% endif %} 13 | 14 | {% for fm in form%} {{fm.label_tag}} {{fm}} {{fm.errors|striptags}} 15 | {% endfor %} 16 |
17 | 18 |
19 | {% endblock %} -------------------------------------------------------------------------------- /eighth_project/first_app/templates/passchange.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html'%} 2 | {% load crispy_forms_tags %} 3 | {% block body %} 4 | 5 |
6 |

Password Change Page

7 | {% csrf_token %} 8 | {% if form.non_field_errors %} 9 | {% for er in form.non_field_errors %} 10 |

{{er}}

11 | {% endfor %} 12 | {% endif %} 13 | 14 | {% for fm in form%} {{fm.label_tag}} {{fm}} 15 |

{{fm.errors|striptags}}

16 | {% endfor %} 17 |
18 | 19 |
20 | {% endblock %} -------------------------------------------------------------------------------- /eighth_project/first_app/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html'%} 2 | {% load crispy_forms_tags %} 3 | {% block body %} 4 | 5 |

welcome to profile

6 |

Hello {{user}}

7 | 8 | {% if messages %} 9 | {% for m in messages %} 10 |

{{m}}

11 | {% endfor %} 12 | {% endif %} 13 |
14 |

Change Your Password 15 | Change Your Password without old pass

16 | 17 |
18 | {% csrf_token %} 19 | {% if form.non_field_errors %} 20 | {% for er in form.non_field_errors %} 21 |

{{er}}

22 | {% endfor %} 23 | {% endif %} 24 | 25 | {% for fm in form%} {{fm.label_tag}} {{fm}} {{fm.errors|striptags}} 26 | {% endfor %} 27 |
28 | 29 |
30 | {% endblock %} -------------------------------------------------------------------------------- /eighth_project/first_app/templates/signup.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load crispy_forms_tags %} 3 | 4 | {% block body %} 5 | {% if messages %} 6 | {% for m in messages %} 7 | {{m}} 8 | {% endfor %} 9 | {% endif %} 10 |
11 |

Signup Page

12 | {% csrf_token %} 13 | 14 | {% for fm in form%} {{fm.label_tag}} {{fm}} {{fm.errors|striptags}} 15 | {% endfor %} 16 |
17 | 18 |
19 | Already have an account Login 20 |
21 | 22 | {% endblock %} 23 | 24 | -------------------------------------------------------------------------------- /eighth_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /eighth_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('', views.home, name='home'), 5 | path('signup/', views.signup, name='signup'), 6 | path('login/', views.user_login, name='login'), 7 | path('logout/', views.user_logout, name='logout'), 8 | path('pass_change/', views.pass_change, name='passchange'), 9 | path('pass_change2/', views.pass_change2, name='passchange2'), 10 | path('profile/', views.profile, name='profile'), 11 | ] -------------------------------------------------------------------------------- /eighth_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eighth_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /fifth_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/db.sqlite3 -------------------------------------------------------------------------------- /fifth_project/fifth_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/fifth_project/__init__.py -------------------------------------------------------------------------------- /fifth_project/fifth_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/fifth_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/fifth_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/fifth_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/fifth_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/fifth_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/fifth_project/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/fifth_project/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/fifth_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/fifth_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/fifth_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for fifth_project 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/4.2/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', 'fifth_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /fifth_project/fifth_project/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | urlpatterns = [ 4 | path('admin/', admin.site.urls), 5 | path('', include("first_app.urls")), 6 | ] 7 | -------------------------------------------------------------------------------- /fifth_project/fifth_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for fifth_project 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/4.2/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', 'fifth_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /fifth_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__init__.py -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/forms.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/forms.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /fifth_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /fifth_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /fifth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fifth_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /fifth_project/first_app/templates/first_app/about.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block title %} About Page {% endblock%} 3 | {% block content %} 4 |

Name {{name}}

5 |

Email {{email}}

6 |

Rating {{select}}

7 | 8 | {% endblock%} -------------------------------------------------------------------------------- /fifth_project/first_app/templates/first_app/django_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html '%} 2 | {% block content %} 3 | {% load crispy_forms_tags %} 4 |
5 | {% csrf_token %} 6 | {{form|crispy}} 7 | 8 |
9 | {%endblock%} -------------------------------------------------------------------------------- /fifth_project/first_app/templates/first_app/form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html '%} {% block content %} 2 | 3 |
4 |

Movie Rating Form

5 |
6 | {% csrf_token %} 7 |
8 | 9 | 16 |
17 |
18 | 19 | 26 |
27 | 35 | 36 |
37 |
38 | 39 | {%endblock%} 40 | -------------------------------------------------------------------------------- /fifth_project/first_app/templates/first_app/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block title%} Home Page {% endblock%} 3 | {% block content %} Home page {{ block.super }} {%endblock%} -------------------------------------------------------------------------------- /fifth_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /fifth_project/first_app/upload/2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/upload/2.pdf -------------------------------------------------------------------------------- /fifth_project/first_app/upload/Abdullah-All-Naim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fifth_project/first_app/upload/Abdullah-All-Naim.png -------------------------------------------------------------------------------- /fifth_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('', views.home, name = "homepage"), 5 | path('about/', views.about, name = "aboutpage"), 6 | path('form/', views.submit_form, name = "submit_form"), 7 | path('django_form/', views.PasswordValidation, name = "django_form"), 8 | ] -------------------------------------------------------------------------------- /fifth_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from . forms import contactForm, StudentData, PasswordValidationProject 3 | # Create your views here. 4 | def home(request): 5 | return render(request, './first_app/home.html') 6 | 7 | def about(request): 8 | if request.method == 'POST': 9 | print(request.POST) 10 | name = request.POST.get('username') 11 | email = request.POST.get('email') 12 | select = request.POST.get('select') 13 | return render(request, './first_app/about.html', {'name' : name, 'email': email, 'select' : select}) 14 | else: 15 | return render(request, './first_app/about.html') 16 | 17 | 18 | def submit_form(request): 19 | return render(request, './first_app/form.html') 20 | 21 | def DjangoForm(request): 22 | if request.method == 'POST': 23 | form = contactForm(request.POST, request.FILES) 24 | if form.is_valid(): 25 | # file = form.cleaned_data['file'] 26 | # with open('./first_app/upload/' + file.name, 'wb+') as destination: 27 | # for chunk in file.chunks(): 28 | # destination.write(chunk) 29 | print(form.cleaned_data) 30 | else: 31 | form = contactForm() 32 | return render(request, './first_app/django_form.html', {'form':form}) 33 | 34 | 35 | def StudentForm(request): 36 | if request.method == 'POST': 37 | form = StudentData(request.POST, request.FILES) 38 | if form.is_valid(): 39 | print(form.cleaned_data) 40 | else: 41 | form = StudentData() 42 | return render(request, './first_app/django_form.html', {'form':form}) 43 | 44 | def PasswordValidation(request): 45 | if request.method == 'POST': 46 | form = PasswordValidationProject(request.POST) 47 | if form.is_valid(): 48 | print(form.cleaned_data) 49 | else: 50 | form = PasswordValidationProject() 51 | return render(request, './first_app/django_form.html', {'form':form}) 52 | 53 | -------------------------------------------------------------------------------- /fifth_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fifth_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /first_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/db.sqlite3 -------------------------------------------------------------------------------- /first_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__init__.py -------------------------------------------------------------------------------- /first_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /first_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /first_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /first_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /first_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /first_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('', views.home), 5 | path('about/', views.about), 6 | ] -------------------------------------------------------------------------------- /first_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.http import HttpResponse 3 | # Create your views here. 4 | 5 | def home(request): 6 | return HttpResponse("

hello, this is my first django page

") 7 | def about(request): 8 | return HttpResponse("hello, this is my about page") -------------------------------------------------------------------------------- /first_project/first_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_project/__init__.py -------------------------------------------------------------------------------- /first_project/first_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_project/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_project/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/first_project/first_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /first_project/first_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for first_project 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/4.2/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', 'first_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /first_project/first_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for first_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | from . import views 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', include('first_app.urls')) 23 | ] 24 | -------------------------------------------------------------------------------- /first_project/first_project/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | 3 | -------------------------------------------------------------------------------- /first_project/first_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for first_project 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/4.2/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', 'first_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /first_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'first_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /fourth_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/db.sqlite3 -------------------------------------------------------------------------------- /fourth_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__init__.py -------------------------------------------------------------------------------- /fourth_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /fourth_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /fourth_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /fourth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /fourth_project/first_app/templates/first_app/about.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load first_tags %} 3 | {% load first_tags %} 4 | {% block title %} About Page {% endblock%} 5 | {% block content %}About page 6 |

{{author}}

7 |

{{author|change_name:'change'}}

8 |

{{author|change_name:'title'}}

9 | 10 | 11 | {% show_courses %} 12 | {% endblock%} -------------------------------------------------------------------------------- /fourth_project/first_app/templates/first_app/courses.html: -------------------------------------------------------------------------------- 1 | {% load first_tags %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {% for course in courses %} 12 | 13 | 14 | 15 | 16 | 17 | {% endfor%} 18 | 19 |
#IDCourse NameCourse Teacher
{{course.id}}{{course.course}}{{course.teacher}}
20 | -------------------------------------------------------------------------------- /fourth_project/first_app/templates/first_app/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block title%} Home Page {% endblock%} 3 | {% block content %} Home page {{ block.super }} {%endblock%} -------------------------------------------------------------------------------- /fourth_project/first_app/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/templatetags/__init__.py -------------------------------------------------------------------------------- /fourth_project/first_app/templatetags/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/templatetags/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/templatetags/__pycache__/first_tags.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/first_app/templatetags/__pycache__/first_tags.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/first_app/templatetags/first_tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | from django.template.loader import get_template 3 | 4 | register = template.Library() 5 | 6 | def my_template(value, arg): 7 | if arg == 'change': 8 | value = 'Rahim' 9 | return value 10 | if arg == 'title': 11 | return value.title() 12 | 13 | def show_courses(): 14 | courses = [ 15 | { 16 | "id" : 1, 17 | "course" : "C", 18 | "teacher" : "Rahim" 19 | }, 20 | { 21 | "id" : 2, 22 | "course" : "C++", 23 | "teacher" : "Kahim" 24 | }, 25 | { 26 | "id" : 3, 27 | "course" : "Python", 28 | "teacher" : "Fahim" 29 | }, 30 | ] 31 | return {'courses' : courses} 32 | 33 | courses_template = get_template('first_app/courses.html') 34 | register.filter('change_name', my_template) 35 | register.inclusion_tag(courses_template)(show_courses) -------------------------------------------------------------------------------- /fourth_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /fourth_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('', views.home, name = "homepage"), 5 | path('about/', views.about, name = "aboutpage"), 6 | ] -------------------------------------------------------------------------------- /fourth_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | # Create your views here. 3 | def home(request): 4 | return render(request, './first_app/home.html', {"name" : "I am Rahim", "marks" : 86,"courses" : [ 5 | { 6 | "id" : 1, 7 | "course" : "C", 8 | "teacher" : "Rahim" 9 | }, 10 | { 11 | "id" : 2, 12 | "course" : "C++", 13 | "teacher" : "Kahim" 14 | }, 15 | { 16 | "id" : 3, 17 | "course" : "Python", 18 | "teacher" : "Fahim" 19 | }, 20 | ]}) 21 | 22 | def about(request): 23 | return render(request, './first_app/about.html', {'author' : 'glenn maxwell'}) -------------------------------------------------------------------------------- /fourth_project/fourth_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/fourth_project/__init__.py -------------------------------------------------------------------------------- /fourth_project/fourth_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/fourth_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/fourth_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/fourth_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/fourth_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/fourth_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/fourth_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/fourth_project/fourth_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /fourth_project/fourth_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for fourth_project 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/4.2/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', 'fourth_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /fourth_project/fourth_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for fourth_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('first_app/', include("first_app.urls")), 23 | ] 24 | -------------------------------------------------------------------------------- /fourth_project/fourth_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for fourth_project 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/4.2/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', 'fourth_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /fourth_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fourth_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /mamar_bank/accounts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__init__.py -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/constants.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/constants.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/forms.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/forms.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import UserBankAccount, UserAddress 3 | # Register your models here. 4 | 5 | admin.site.register(UserBankAccount) 6 | admin.site.register(UserAddress) -------------------------------------------------------------------------------- /mamar_bank/accounts/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountsConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'accounts' 7 | -------------------------------------------------------------------------------- /mamar_bank/accounts/constants.py: -------------------------------------------------------------------------------- 1 | ACCOUNT_TYPE = ( 2 | ('Savings', 'Savings'), 3 | ('Current', 'Current'), 4 | ) 5 | GENDER_TYPE = ( 6 | ('Male', 'Male'), 7 | ('Female', 'Female'), 8 | ) -------------------------------------------------------------------------------- /mamar_bank/accounts/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/migrations/__init__.py -------------------------------------------------------------------------------- /mamar_bank/accounts/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/accounts/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/accounts/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | from .constants import ACCOUNT_TYPE, GENDER_TYPE 4 | # django amaderke built in user niye kaj korar facility dey 5 | 6 | 7 | class UserBankAccount(models.Model): 8 | user = models.OneToOneField(User, related_name='account', on_delete=models.CASCADE) 9 | account_type = models.CharField(max_length=10, choices=ACCOUNT_TYPE) 10 | account_no = models.IntegerField(unique=True) # account no duijon user er kokhono same hobe na 11 | birth_date = models.DateField(null=True, blank=True) 12 | gender = models.CharField(max_length=10, choices=GENDER_TYPE) 13 | initial_deposite_date = models.DateField(auto_now_add=True) 14 | balance = models.DecimalField(default=0, max_digits=12, decimal_places=2) # ekjon user 12 digit obdi taka rakhte parbe, dui doshomik ghor obdi rakhte parben 1000.50 15 | def __str__(self): 16 | return str(self.account_no) 17 | 18 | class UserAddress(models.Model): 19 | user = models.OneToOneField(User, related_name='address', on_delete=models.CASCADE) 20 | street_address = models.CharField(max_length=100) 21 | city = models.CharField(max_length= 100) 22 | postal_code = models.IntegerField() 23 | country = models.CharField(max_length=100) 24 | def __str__(self): 25 | return str(self.user.email) 26 | -------------------------------------------------------------------------------- /mamar_bank/accounts/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /mamar_bank/accounts/urls.py: -------------------------------------------------------------------------------- 1 | 2 | from django.urls import path 3 | from .views import UserRegistrationView, UserLoginView, UserLogoutView,UserBankAccountUpdateView 4 | 5 | urlpatterns = [ 6 | path('register/', UserRegistrationView.as_view(), name='register'), 7 | path('login/', UserLoginView.as_view(), name='login'), 8 | path('logout/', UserLogoutView.as_view(), name='logout'), 9 | path('profile/', UserBankAccountUpdateView.as_view(), name='profile' ) 10 | ] -------------------------------------------------------------------------------- /mamar_bank/accounts/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views.generic import FormView 3 | from .forms import UserRegistrationForm,UserUpdateForm 4 | from django.contrib.auth import login, logout 5 | from django.urls import reverse_lazy 6 | from django.contrib.auth.views import LoginView, LogoutView 7 | from django.views import View 8 | from django.shortcuts import redirect 9 | 10 | class UserRegistrationView(FormView): 11 | template_name = 'accounts/user_registration.html' 12 | form_class = UserRegistrationForm 13 | success_url = reverse_lazy('profile') 14 | 15 | def form_valid(self,form): 16 | print(form.cleaned_data) 17 | user = form.save() 18 | login(self.request, user) 19 | print(user) 20 | return super().form_valid(form) # form_valid function call hobe jodi sob thik thake 21 | 22 | 23 | class UserLoginView(LoginView): 24 | template_name = 'accounts/user_login.html' 25 | def get_success_url(self): 26 | return reverse_lazy('home') 27 | 28 | class UserLogoutView(LogoutView): 29 | def get_success_url(self): 30 | if self.request.user.is_authenticated: 31 | logout(self.request) 32 | return reverse_lazy('home') 33 | 34 | 35 | class UserBankAccountUpdateView(View): 36 | template_name = 'accounts/profile.html' 37 | 38 | def get(self, request): 39 | form = UserUpdateForm(instance=request.user) 40 | return render(request, self.template_name, {'form': form}) 41 | 42 | def post(self, request): 43 | form = UserUpdateForm(request.POST, instance=request.user) 44 | if form.is_valid(): 45 | form.save() 46 | return redirect('profile') # Redirect to the user's profile page 47 | return render(request, self.template_name, {'form': form}) 48 | 49 | 50 | -------------------------------------------------------------------------------- /mamar_bank/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/__init__.py -------------------------------------------------------------------------------- /mamar_bank/core/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/core/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/core/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/core/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/core/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /mamar_bank/core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'core' 7 | -------------------------------------------------------------------------------- /mamar_bank/core/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/migrations/__init__.py -------------------------------------------------------------------------------- /mamar_bank/core/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/core/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /mamar_bank/core/static/img/bank.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/core/static/img/bank.jpg -------------------------------------------------------------------------------- /mamar_bank/core/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% block head_title %}Banking System{% endblock %} 10 | 11 | 12 | 13 | {% block head_extra %}{% endblock %} 14 | 21 | 22 | 23 | {% include 'navbar.html' %} 24 | {% block body %} 25 |
26 | {% include 'messages.html' %} 27 | {% block content %} 28 | {% endblock %} 29 |
30 | {% include 'footer.html' %} 31 | 32 | {% endblock %} 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /mamar_bank/core/templates/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

6 | © {% now "Y" %} Modified by Phitron Team 7 |

8 |
9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /mamar_bank/core/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block head_title %}Banking System{% endblock %} {% block content %} 5 |
6 | 7 | 8 |
9 |

Welcome to Mamar Bank

10 |

11 | This is a simple Mamar Bank where you can deposit money, withdraw money, take loan. You can also create an account, login, logout. Lorem ipsum dolor sit amet consectetur adipisicing elit. Sed nemo quaerat quo dicta, adipisci eum fuga ratione id numquam eius veniam placeat voluptatum, itaque tempora molestias vel, blanditiis fugiat ipsam! 12 | 13 |

14 |
15 | Register 16 |
17 |
18 |
19 | 20 |
21 |
22 | 23 | {% endblock %} -------------------------------------------------------------------------------- /mamar_bank/core/templates/messages.html: -------------------------------------------------------------------------------- 1 | {% for message in messages %} 2 | 3 | 12 | 13 | {% endfor %} 14 | -------------------------------------------------------------------------------- /mamar_bank/core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /mamar_bank/core/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views.generic import TemplateView 3 | # Create your views here. 4 | 5 | class HomeView(TemplateView): 6 | template_name = 'index.html' 7 | -------------------------------------------------------------------------------- /mamar_bank/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/db.sqlite3 -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/mamar_bank/__init__.py -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/mamar_bank/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/mamar_bank/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/mamar_bank/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/mamar_bank/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for mamar_bank 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/4.2/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', 'mamar_bank.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for mamar_bank project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | from core.views import HomeView 20 | urlpatterns = [ 21 | path('', HomeView.as_view(), name='home'), 22 | path('admin/', admin.site.urls), 23 | path('accounts/', include('accounts.urls')), 24 | path('transactions/', include('transactions.urls')), 25 | ] 26 | 27 | # accounts/login 28 | # accounts/register -------------------------------------------------------------------------------- /mamar_bank/mamar_bank/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for mamar_bank 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/4.2/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', 'mamar_bank.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /mamar_bank/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mamar_bank.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /mamar_bank/transactions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__init__.py -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/constants.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/constants.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/forms.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/forms.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # from transactions.models import Transaction 4 | from .models import Transaction 5 | @admin.register(Transaction) 6 | class TransactionAdmin(admin.ModelAdmin): 7 | list_display = ['account', 'amount', 'balance_after_transaction', 'transaction_type', 'loan_approve'] 8 | 9 | def save_model(self, request, obj, form, change): 10 | obj.account.balance += obj.amount 11 | obj.balance_after_transaction = obj.account.balance 12 | obj.account.save() 13 | super().save_model(request, obj, form, change) 14 | 15 | -------------------------------------------------------------------------------- /mamar_bank/transactions/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TransactionsConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'transactions' 7 | -------------------------------------------------------------------------------- /mamar_bank/transactions/constants.py: -------------------------------------------------------------------------------- 1 | DEPOSIT = 1 2 | WITHDRAWAL = 2 3 | LOAN = 3 4 | LOAN_PAID = 4 5 | 6 | TRANSACTION_TYPE = ( 7 | (DEPOSIT, 'Deposite'), 8 | (WITHDRAWAL, 'Withdrawal'), 9 | (LOAN, 'Loan'), 10 | (LOAN_PAID, 'Loan Paid'), 11 | 12 | ) -------------------------------------------------------------------------------- /mamar_bank/transactions/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2.4 on 2023-08-20 01:26 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ('accounts', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Transaction', 18 | fields=[ 19 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('amount', models.DecimalField(decimal_places=2, max_digits=12)), 21 | ('balance_after_transaction', models.DecimalField(decimal_places=2, max_digits=12)), 22 | ('transaction_type', models.IntegerField(choices=[(1, 'Deposite'), (2, 'Withdrawal'), (3, 'Loan'), (4, 'Loan Paid')], null=True)), 23 | ('timestamp', models.DateTimeField(auto_now_add=True)), 24 | ('loan_approve', models.BooleanField(default=False)), 25 | ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='accounts.userbankaccount')), 26 | ], 27 | options={ 28 | 'ordering': ['timestamp'], 29 | }, 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /mamar_bank/transactions/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/migrations/__init__.py -------------------------------------------------------------------------------- /mamar_bank/transactions/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/mamar_bank/transactions/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /mamar_bank/transactions/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from accounts.models import UserBankAccount 3 | # Create your models here. 4 | from .constants import TRANSACTION_TYPE 5 | 6 | class Transaction(models.Model): 7 | account = models.ForeignKey(UserBankAccount, related_name = 'transactions', on_delete = models.CASCADE) # ekjon user er multiple transactions hote pare 8 | 9 | amount = models.DecimalField(decimal_places=2, max_digits = 12) 10 | balance_after_transaction = models.DecimalField(decimal_places=2, max_digits = 12) 11 | transaction_type = models.IntegerField(choices=TRANSACTION_TYPE, null = True) 12 | timestamp = models.DateTimeField(auto_now_add=True) 13 | loan_approve = models.BooleanField(default=False) 14 | 15 | class Meta: 16 | ordering = ['timestamp'] -------------------------------------------------------------------------------- /mamar_bank/transactions/templates/transactions/loan_request.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block head_title %}{{ title }}{% endblock %} 3 | {% block content %} 4 |
5 |

Loan Report

6 |
7 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {% for loan in loans %} 22 | 23 | 26 | 33 | 36 | 43 | 44 | {% endfor %} 45 | 46 |
LOAN IDLoan AmountLoan ApprovedAction
24 | {{ loan.id }} 25 | 27 | 30 | {{ loan.amount }} 31 | 32 | 34 | {{ loan.loan_approve }} 35 | 37 | {% if loan.loan_approve %} 38 | Pay 39 | {% else %} 40 |

Loan Pending

41 | {% endif %} 42 |
47 |
48 | {% endblock %} -------------------------------------------------------------------------------- /mamar_bank/transactions/templates/transactions/transaction_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} {% block head_title %}{{ title }}{% endblock %} {% block content %} 2 | 3 |
4 |
5 | {% if title == 'Request For Loan' %} 6 |
View All Loan List
7 | {% endif %} 8 | 9 |

{{ title }}

10 |
11 | {% csrf_token %} 12 | 13 |
14 | 17 | 18 |
19 | {% if form.amount.errors %} {% for error in form.amount.errors %} 20 |

{{ error }}

21 | {% endfor %} {% endif %} 22 |
23 | 26 |
27 |
28 |
29 | 30 |
31 | {% endblock %} -------------------------------------------------------------------------------- /mamar_bank/transactions/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /mamar_bank/transactions/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import DepositMoneyView, WithdrawMoneyView, TransactionReportView,LoanRequestView,LoanListView,PayLoanView 3 | 4 | 5 | # app_name = 'transactions' 6 | urlpatterns = [ 7 | path("deposit/", DepositMoneyView.as_view(), name="deposit_money"), 8 | path("report/", TransactionReportView.as_view(), name="transaction_report"), 9 | path("withdraw/", WithdrawMoneyView.as_view(), name="withdraw_money"), 10 | path("loan_request/", LoanRequestView.as_view(), name="loan_request"), 11 | path("loans/", LoanListView.as_view(), name="loan_list"), 12 | path("loans//", PayLoanView.as_view(), name="pay"), 13 | ] -------------------------------------------------------------------------------- /ninth_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/db.sqlite3 -------------------------------------------------------------------------------- /ninth_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__init__.py -------------------------------------------------------------------------------- /ninth_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /ninth_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /ninth_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /ninth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /ninth_project/first_app/templates/del.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

Cookie is deleting...

11 | 12 | -------------------------------------------------------------------------------- /ninth_project/first_app/templates/get_cookie.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

This is get cookie page

11 |

Cookie is getting...

12 |

{{name}}

13 | 14 | -------------------------------------------------------------------------------- /ninth_project/first_app/templates/get_session.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

Session is getting

11 |

{{name}}

12 | 13 | 14 | -------------------------------------------------------------------------------- /ninth_project/first_app/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

This is home page

11 |

Cookie is setting...

12 |

{{name}}

13 | 14 | -------------------------------------------------------------------------------- /ninth_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /ninth_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('',views.set_session ), 5 | path('get/',views.get_session ), 6 | path('del/',views.delete_session ), 7 | ] -------------------------------------------------------------------------------- /ninth_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from datetime import datetime, timedelta 3 | from django.http import HttpResponse 4 | # cookie --- 5 | def home(request): 6 | response = render(request, 'home.html') 7 | response.set_cookie('name', 'rahim') 8 | # response.set_cookie('name', 'karim', max_age=60*3) 9 | response.set_cookie('name', 'karim', expires=datetime.utcnow()+timedelta(days=7)) 10 | return response 11 | def get_cookie(request): 12 | name = request.COOKIES.get('name') 13 | print(request.COOKIES) 14 | return render(request, 'get_cookie.html', {'name':name}) 15 | 16 | def delete_cookie(request): 17 | response = render(request, 'del.html') 18 | response.delete_cookie('name') 19 | return response 20 | 21 | # Django Session 22 | # session vs cookie 23 | 24 | def set_session(request): 25 | # data = { 26 | # 'name' : 'rahim', 27 | # 'age' : 23, 28 | # 'language' : 'Bangla' 29 | # } 30 | # print(request.session.get_session_cookie_age()) 31 | # print(request.session.get_expiry_date()) 32 | # request.session.update(data) 33 | request.session['name'] = 'Karim' 34 | return render(request,'home.html') 35 | 36 | def get_session(request): 37 | if 'name' in request.session: 38 | name = request.session.get('name', 'Guest') 39 | request.session.modified = True 40 | return render(request,'get_session.html' ,{'name' : name}) 41 | else: 42 | return HttpResponse("Your session has been expired.Login again") 43 | 44 | def delete_session(request): 45 | # del request.session['name'] 46 | request.session.flush() 47 | return render(request,'del.html') 48 | 49 | -------------------------------------------------------------------------------- /ninth_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ninth_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /ninth_project/ninth_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/ninth_project/__init__.py -------------------------------------------------------------------------------- /ninth_project/ninth_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/ninth_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/ninth_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/ninth_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/ninth_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/ninth_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/ninth_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/ninth_project/ninth_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /ninth_project/ninth_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for ninth_project 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/4.2/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', 'ninth_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /ninth_project/ninth_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for ninth_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', include('first_app.urls')) 23 | ] 24 | -------------------------------------------------------------------------------- /ninth_project/ninth_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for ninth_project 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/4.2/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', 'ninth_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /second_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/db.sqlite3 -------------------------------------------------------------------------------- /second_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__init__.py -------------------------------------------------------------------------------- /second_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /second_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /second_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /second_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /second_project/first_app/templates/first_app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

hi this is naim

11 | 12 | -------------------------------------------------------------------------------- /second_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /second_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('contact/', views.contact), 5 | path('about/', views.about), 6 | ] -------------------------------------------------------------------------------- /second_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | from django.http import HttpResponse 4 | # Create your views here. 5 | 6 | def contact(request): 7 | return render(request, './first_app/index.html') 8 | def about(request): 9 | return HttpResponse(''' 10 |

This is about page

11 | Contact 12 | Courses 13 | Feedback 14 | ''') 15 | -------------------------------------------------------------------------------- /second_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'second_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /second_project/second_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__init__.py -------------------------------------------------------------------------------- /second_project/second_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /second_project/second_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class SecondAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'second_app' 7 | -------------------------------------------------------------------------------- /second_project/second_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/migrations/__init__.py -------------------------------------------------------------------------------- /second_project/second_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /second_project/second_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /second_project/second_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('courses/', views.courses), 5 | path('feedback/', views.feedback), 6 | ] -------------------------------------------------------------------------------- /second_project/second_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.http import HttpResponse 3 | # Create your views here. 4 | 5 | def courses(request): 6 | return HttpResponse(''' 7 |

This is courses page

8 | Feedback 9 | About 10 | Contact 11 | ''') 12 | def feedback(request): 13 | return HttpResponse(''' 14 |

This is feedback page

15 | Courses 16 | About 17 | Contact 18 | ''') -------------------------------------------------------------------------------- /second_project/second_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_project/__init__.py -------------------------------------------------------------------------------- /second_project/second_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_project/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_project/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/second_project/second_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /second_project/second_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for second_project 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/4.2/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', 'second_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /second_project/second_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for second_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | from . import views 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', views.home), 23 | path('first_app/', include('first_app.urls')), 24 | path('second_app/', include('second_app.urls')), 25 | 26 | ] 27 | -------------------------------------------------------------------------------- /second_project/second_project/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | from django.shortcuts import render 3 | def home(request): 4 | return render(request, 'index.html', {'title' : 'Home Page', 'Author':'Naim'}) -------------------------------------------------------------------------------- /second_project/second_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for second_project 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/4.2/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', 'second_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /second_project/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

hello this is {{Author}}

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /seventh_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/db.sqlite3 -------------------------------------------------------------------------------- /seventh_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__init__.py -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/forms.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/forms.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from first_app.models import StudentModel,StudentInfoModel, TeacherInfoModel, EmployeeModel, ManagerModel, Friend, Me, Person, Passport, Post, Student, Teacher 3 | # Register your models here. 4 | # admin.site.register(StudentModel) 5 | # admin.site.register(StudentInfoModel) 6 | # admin.site.register(TeacherInfoModel) 7 | # admin.site.register(EmployeeModel) 8 | # admin.site.register(ManagerModel) 9 | 10 | # @admin.register(EmployeeModel) 11 | # class EmployeeModelAdmin(admin.ModelAdmin): 12 | # list_display = ['id', 'name', 'city', 'designation'] 13 | # @admin.register(ManagerModel) 14 | # class ManagerModelAdmin(admin.ModelAdmin): 15 | # list_display = ['id', 'name', 'city', 'designation', 'take_interview', 'hiring'] 16 | 17 | # @admin.register(Friend) 18 | # class FriendModelAdmin(admin.ModelAdmin): 19 | # list_display = ['id', 'school','section','attendence', 'hw'] 20 | # @admin.register(Me) 21 | # class MeModelAdmin(admin.ModelAdmin): 22 | # list_display = ['id', 'school','section','attendence', 'hw'] 23 | 24 | # @admin.register(Person) 25 | # class PersonModelAdmin(admin.ModelAdmin): 26 | # list_display = ['id', 'name','city','email'] 27 | # @admin.register(Post) 28 | # class PostModelAdmin(admin.ModelAdmin): 29 | # list_display = ['id', 'user','post_cap','post_details'] 30 | # @admin.register(Passport) 31 | # class PassportModelAdmin(admin.ModelAdmin): 32 | # list_display = ['id', 'user','pass_number','page', 'validity'] 33 | 34 | 35 | @admin.register(Student) 36 | class StudentModelAdmin(admin.ModelAdmin): 37 | list_display = ['id', 'name','roll','class_name'] 38 | @admin.register(Teacher) 39 | class TeacherModelAdmin(admin.ModelAdmin): 40 | list_display = ['id','name','subject','student_list' ,'mobile'] -------------------------------------------------------------------------------- /seventh_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /seventh_project/first_app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from first_app.models import StudentModel 3 | 4 | class StudentForm(forms.ModelForm): 5 | class Meta: 6 | model = StudentModel 7 | fields = '__all__' 8 | labels = { 9 | 'name' : 'Student Name', 10 | 'roll' : "Student Roll" 11 | } 12 | widgets = { 13 | 'name' : forms.TextInput(), 14 | } 15 | help_texts = { 16 | 'name' : "Write your full name" 17 | } 18 | 19 | error_messages = { 20 | 'name' : {'required' : 'Your name is required'} 21 | } 22 | 23 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-04-27 05:29 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='StudentModel', 16 | fields=[ 17 | ('roll', models.IntegerField(primary_key=True, serialize=False)), 18 | ('name', models.CharField(max_length=20)), 19 | ('father_name', models.CharField(max_length=30)), 20 | ('address', models.TextField()), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0002_bankmanagement.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-04-27 06:42 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('first_app', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='BankManagement', 15 | fields=[ 16 | ('id', models.IntegerField(primary_key=True, serialize=False)), 17 | ('balance', models.IntegerField(default=0)), 18 | ('deposite', models.IntegerField(default=0)), 19 | ('date', models.DateTimeField(auto_now_add=True)), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0003_studentinfomodel_teacherinfomodel_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-05-21 04:13 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('first_app', '0002_bankmanagement'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='StudentInfoModel', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=20)), 18 | ('city', models.CharField(max_length=50)), 19 | ('roll', models.IntegerField()), 20 | ('payment', models.IntegerField()), 21 | ('section', models.CharField(max_length=20)), 22 | ], 23 | options={ 24 | 'abstract': False, 25 | }, 26 | ), 27 | migrations.CreateModel( 28 | name='TeacherInfoModel', 29 | fields=[ 30 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 31 | ('name', models.CharField(max_length=20)), 32 | ('city', models.CharField(max_length=50)), 33 | ('salary', models.IntegerField()), 34 | ], 35 | options={ 36 | 'abstract': False, 37 | }, 38 | ), 39 | migrations.DeleteModel( 40 | name='BankManagement', 41 | ), 42 | ] 43 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0004_employeemodel_managermodel.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-05-21 05:04 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('first_app', '0003_studentinfomodel_teacherinfomodel_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='EmployeeModel', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=30)), 19 | ('city', models.CharField(max_length=40)), 20 | ('designation', models.CharField(max_length=20)), 21 | ], 22 | ), 23 | migrations.CreateModel( 24 | name='ManagerModel', 25 | fields=[ 26 | ('employeemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='first_app.employeemodel')), 27 | ('take_interview', models.BooleanField()), 28 | ('hiring', models.BooleanField()), 29 | ], 30 | bases=('first_app.employeemodel',), 31 | ), 32 | ] 33 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0005_friend_me.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-05-21 05:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('first_app', '0004_employeemodel_managermodel'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Friend', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('school', models.CharField(max_length=40)), 18 | ('section', models.CharField(max_length=10)), 19 | ('attendence', models.BooleanField()), 20 | ('hw', models.CharField(max_length=50)), 21 | ], 22 | ), 23 | migrations.CreateModel( 24 | name='Me', 25 | fields=[ 26 | ], 27 | options={ 28 | 'proxy': True, 29 | 'indexes': [], 30 | 'constraints': [], 31 | }, 32 | bases=('first_app.friend',), 33 | ), 34 | ] 35 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0006_person_alter_me_options_passport.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-05-21 07:36 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('first_app', '0005_friend_me'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Person', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=30)), 19 | ('city', models.CharField(max_length=50)), 20 | ('email', models.EmailField(max_length=30)), 21 | ], 22 | ), 23 | migrations.AlterModelOptions( 24 | name='me', 25 | options={'ordering': ['id']}, 26 | ), 27 | migrations.CreateModel( 28 | name='Passport', 29 | fields=[ 30 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 31 | ('pass_number', models.IntegerField()), 32 | ('page', models.IntegerField()), 33 | ('validity', models.IntegerField()), 34 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='first_app.person')), 35 | ], 36 | ), 37 | ] 38 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0007_post.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-05-21 10:18 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('first_app', '0006_person_alter_me_options_passport'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Post', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('post_cap', models.CharField(max_length=30)), 19 | ('post_details', models.CharField(max_length=100)), 20 | ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='first_app.person')), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/0008_student_teacher.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-05-21 11:10 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('first_app', '0007_post'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Student', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=30)), 18 | ('roll', models.IntegerField()), 19 | ('class_name', models.CharField(max_length=10)), 20 | ], 21 | ), 22 | migrations.CreateModel( 23 | name='Teacher', 24 | fields=[ 25 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 26 | ('name', models.CharField(max_length=30)), 27 | ('subject', models.CharField(max_length=20)), 28 | ('mobile', models.CharField(max_length=11)), 29 | ('student', models.ManyToManyField(to='first_app.student')), 30 | ], 31 | ), 32 | ] 33 | -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0002_bankmanagement.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0002_bankmanagement.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0003_studentinfomodel_teacherinfomodel_and_more.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0003_studentinfomodel_teacherinfomodel_and_more.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0004_employeemodel_managermodel.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0004_employeemodel_managermodel.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0005_friend_me.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0005_friend_me.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0006_person_alter_me_options_passport.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0006_person_alter_me_options_passport.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0007_post.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0007_post.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/0008_student_teacher.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/0008_student_teacher.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/first_app/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 14 | 15 | 16 | {% load crispy_forms_tags %} 17 |

Home page

18 |
19 |
20 | {% csrf_token %} 21 | {{form|crispy}} 22 | 23 | 24 |
25 |
26 | 31 | 36 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /seventh_project/first_app/templates/show_data.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 14 | 15 | 16 |

Show Data Page

17 | 22 | 27 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /seventh_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /seventh_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | # from . import views 3 | from first_app.views import home, showData 4 | urlpatterns = [ 5 | path('', home, name='homepage'), 6 | path('show/', showData, name='showData'), 7 | ] 8 | -------------------------------------------------------------------------------- /seventh_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from first_app.forms import StudentForm 3 | from . models import Teacher, Student 4 | # Create your views here. 5 | def home(request): 6 | if request.method == 'POST': 7 | form = StudentForm(request.POST) 8 | if form.is_valid(): 9 | form.save() 10 | else: 11 | form = StudentForm() 12 | return render(request, 'home.html', {'form' : form}) 13 | 14 | def showData(request): 15 | # students list for one teacher 16 | teacher = Teacher.objects.get(name = 'Tarek') 17 | students =teacher.student.all() 18 | for stud in students: 19 | print(stud.name, stud.roll, stud.class_name) 20 | # teachers list for one student 21 | # student = Student.objects.get(name = 'Arup') 22 | # teachers =student.teachers.all() 23 | # for teacher in teachers: 24 | # print(f"{teacher.name} {teacher.subject} {teacher.mobile}") 25 | return render(request, 'show_data.html') 26 | 27 | -------------------------------------------------------------------------------- /seventh_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'seventh_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /seventh_project/seventh_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/seventh_project/__init__.py -------------------------------------------------------------------------------- /seventh_project/seventh_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/seventh_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/seventh_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/seventh_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/seventh_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/seventh_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/seventh_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/seventh_project/seventh_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /seventh_project/seventh_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for seventh_project 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/4.2/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', 'seventh_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /seventh_project/seventh_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for seventh_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path, include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path("", include("first_app.urls")), 23 | ] 24 | -------------------------------------------------------------------------------- /seventh_project/seventh_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for seventh_project 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/4.2/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', 'seventh_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /sixth_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/db.sqlite3 -------------------------------------------------------------------------------- /sixth_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__init__.py -------------------------------------------------------------------------------- /sixth_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from . import models 3 | # Register your models here. 4 | admin.site.register(models.Student) -------------------------------------------------------------------------------- /sixth_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /sixth_project/first_app/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-04-25 15:21 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Student', 16 | fields=[ 17 | ('name', models.CharField(max_length=20)), 18 | ('roll', models.IntegerField(primary_key=True, serialize=False)), 19 | ('address', models.TextField()), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /sixth_project/first_app/migrations/0002_student_father_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2 on 2023-04-25 15:24 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('first_app', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='student', 15 | name='father_name', 16 | field=models.TextField(default='Rahim'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /sixth_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /sixth_project/first_app/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/migrations/__pycache__/0002_student_father_name.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/migrations/__pycache__/0002_student_father_name.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | class Student(models.Model): 6 | name = models.CharField(max_length= 20) 7 | roll = models.IntegerField(primary_key= True) 8 | address = models.TextField() 9 | father_name = models.TextField(default="Rahim") 10 | 11 | def __str__(self): 12 | return f"Roll : {self.roll} - {self.name}" -------------------------------------------------------------------------------- /sixth_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /sixth_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('', views.home, name="homepage"), 5 | path('delete/', views.delete_student, name="delete_student"), 6 | ] -------------------------------------------------------------------------------- /sixth_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, redirect 2 | from . import models 3 | # Create your views here. 4 | def home(request): 5 | student = models.Student.objects.all() 6 | return render(request,"home.html", {'data': student}) 7 | 8 | def delete_student(request, roll): 9 | std = models.Student.objects.get(pk = roll).delete() 10 | return redirect("homepage") -------------------------------------------------------------------------------- /sixth_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sixth_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /sixth_project/sixth_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/sixth_project/__init__.py -------------------------------------------------------------------------------- /sixth_project/sixth_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/sixth_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/sixth_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/sixth_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/sixth_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/sixth_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/sixth_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/sixth_project/sixth_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /sixth_project/sixth_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for sixth_project 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/4.2/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', 'sixth_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /sixth_project/sixth_project/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for sixth_project project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path,include 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('',include("first_app.urls")), 23 | ] 24 | -------------------------------------------------------------------------------- /sixth_project/sixth_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for sixth_project 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/4.2/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', 'sixth_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /third_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/db.sqlite3 -------------------------------------------------------------------------------- /third_project/first_app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__init__.py -------------------------------------------------------------------------------- /third_project/first_app/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /third_project/first_app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FirstAppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'first_app' 7 | -------------------------------------------------------------------------------- /third_project/first_app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/migrations/__init__.py -------------------------------------------------------------------------------- /third_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/first_app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /third_project/first_app/static/first_app/css/first.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: red; 3 | } 4 | 5 | h1{ 6 | color : brown; 7 | font-size : 50px; 8 | } -------------------------------------------------------------------------------- /third_project/first_app/static/first_app/images/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/static/first_app/images/image1.jpg -------------------------------------------------------------------------------- /third_project/first_app/static/first_app/images/img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/first_app/static/first_app/images/img2.jpg -------------------------------------------------------------------------------- /third_project/first_app/static/first_app/js/index.js: -------------------------------------------------------------------------------- 1 | console.log("Hello this is a js file") -------------------------------------------------------------------------------- /third_project/first_app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /third_project/first_app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | urlpatterns = [ 4 | path('contact/', views.contact), 5 | ] -------------------------------------------------------------------------------- /third_project/first_app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | def contact(request): 5 | return render(request, './first_app/index.html', {"name" : "I am Rahim", "marks" : 86, "lst" : [24,3,10,5], "blog" : "Lorem ipsum dolor, sit amet consectetur adipisicing elit. Harum quae tempora fugit laborum voluptas mollitia. Explicabo earum assumenda obcaecati et.", "courses" : [ 6 | { 7 | "id" : 1, 8 | "course" : "C", 9 | "teacher" : "Rahim" 10 | }, 11 | { 12 | "id" : 2, 13 | "course" : "C++", 14 | "teacher" : "Kahim" 15 | }, 16 | { 17 | "id" : 3, 18 | "course" : "Python", 19 | "teacher" : "Fahim" 20 | }, 21 | ]}) -------------------------------------------------------------------------------- /third_project/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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'third_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /third_project/static/css/first.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: yellow; 3 | } 4 | 5 | h1{ 6 | color : red; 7 | } -------------------------------------------------------------------------------- /third_project/static/images/bird.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/static/images/bird.jpg -------------------------------------------------------------------------------- /third_project/static/images/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/static/images/image1.jpg -------------------------------------------------------------------------------- /third_project/static/js/index.js: -------------------------------------------------------------------------------- 1 | console.log("Hello this is a js file") -------------------------------------------------------------------------------- /third_project/templates/index.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 |

This is my first ever template in django

13 | This is a link 14 | {% static 'images/image1.jpg' as nature %} 15 | Nature Image 16 | BIRD Image 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /third_project/third_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/third_project/__init__.py -------------------------------------------------------------------------------- /third_project/third_project/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/third_project/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/third_project/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/third_project/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/third_project/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/third_project/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/third_project/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/third_project/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/third_project/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abdullahallnaim/django-codes/1cc12403eb18654844063bbe11b317b39058af0a/third_project/third_project/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /third_project/third_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for third_project 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/4.2/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', 'third_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /third_project/third_project/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.conf import settings 3 | from django.conf.urls.static import static 4 | from django.urls import path,include 5 | from . import views 6 | urlpatterns = [ 7 | path('admin/', admin.site.urls), 8 | path('', views.home), 9 | path('first_app/', include('first_app.urls')), 10 | ] + static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT) 11 | -------------------------------------------------------------------------------- /third_project/third_project/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | def home(request): 4 | return render(request, 'index.html') -------------------------------------------------------------------------------- /third_project/third_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for third_project 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/4.2/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', 'third_project.settings') 15 | 16 | application = get_wsgi_application() 17 | --------------------------------------------------------------------------------