Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvpandey0 committed Jul 2, 2020
0 parents commit 4e63fae
Show file tree
Hide file tree
Showing 62 changed files with 669 additions and 0 deletions.
1 change: 1 addition & 0 deletions .~lock.bank_branches.csv#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,apoorvpandey0,apoorv-pc,02.07.2020 17:51,file:///home/apoorvpandey0/.config/libreoffice/4;
Empty file added banks/__init__.py
Empty file.
Binary file added banks/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added banks/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file added banks/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added banks/__pycache__/wsgi.cpython-38.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions banks/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for banks project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'banks.settings')

application = get_asgi_application()
126 changes: 126 additions & 0 deletions banks/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
"""
Django settings for banks project.
Generated by 'django-admin startproject' using Django 3.0.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '02s3-dvv%ft4&t3cjn23@&eexkp+s7#7l&y@&(2s^@vuq3bp23'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#My apps
'ifscfinder',
#Third Party apps
'import_export',
'rest_framework',
'django_filters',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'banks.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'banks.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'
23 changes: 23 additions & 0 deletions banks/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""banks URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include

urlpatterns = [
path('admin/', admin.site.urls),
path('home/',include('ifscfinder.urls'),name='ifscfinder'),
path('', include('ifscfinder.api.urls'),name = 'api-Bank'),
]
16 changes: 16 additions & 0 deletions banks/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for banks project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'banks.settings')

application = get_wsgi_application()
Binary file added db.sqlite3
Binary file not shown.
Empty file added ifscfinder/__init__.py
Empty file.
Binary file added ifscfinder/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/__pycache__/views.cpython-38.pyc
Binary file not shown.
22 changes: 22 additions & 0 deletions ifscfinder/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.contrib import admin

from import_export.admin import ImportExportMixin
from import_export import resources

from .models import Bank
# Register your models here.
class BankResource(resources.ModelResource):

class Meta:
model = Bank

class BankAdmin(ImportExportMixin,admin.ModelAdmin):
list_display = ("bank_name",'bank_id','district','state','branch','ifsc','city','address')
search_fields = ("bank_name",'bank_id','district','state','branch','ifsc','city','address')
list_editable = ()
readonly_fields = ()
filter_horizntal= ()
list_filter = ('state',)
fieldsets = ()

admin.site.register(Bank,BankAdmin)
Empty file added ifscfinder/api/__init__.py
Empty file.
Binary file added ifscfinder/api/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/api/__pycache__/pagination.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added ifscfinder/api/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added ifscfinder/api/__pycache__/views.cpython-38.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions ifscfinder/api/pagination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from rest_framework.pagination import PageNumberPagination

class BankPageNumberPagination(PageNumberPagination):
page_size = 50
16 changes: 16 additions & 0 deletions ifscfinder/api/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from rest_framework import serializers

from django.urls import reverse

from ..models import Bank

class BankDetailSerializer(serializers.ModelSerializer):
class Meta:
model = Bank
fields =["bank_name",'bank_id','district','state','branch','ifsc','city','address']


class BankListSerializer(serializers.ModelSerializer):
class Meta:
model = Bank
fields =["bank_name",'bank_id','district','state','branch','ifsc','city','address']
7 changes: 7 additions & 0 deletions ifscfinder/api/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from . import views

urlpatterns=[
path('',views.BankListAPIView.as_view(),name = 'api-bank-list'),
]
24 changes: 24 additions & 0 deletions ifscfinder/api/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from rest_framework.generics import ListAPIView,RetrieveAPIView
from rest_framework.permissions import (AllowAny,IsAuthenticated,IsAdminUser,IsAuthenticatedOrReadOnly,)
from rest_framework.filters import (SearchFilter,OrderingFilter)
from rest_framework.pagination import (LimitOffsetPagination,PageNumberPagination)

from django.db.models import Q
from django_filters import rest_framework as filters

from ..models import Bank
from .pagination import BankPageNumberPagination
from .serializers import BankListSerializer,BankDetailSerializer

class BankDetailAPIView(RetrieveAPIView):
queryset = Bank.objects.all()
serializer_class = BankDetailSerializer

class BankListAPIView(ListAPIView):
queryset = Bank.objects.all()
serializer_class = BankListSerializer
pagination_class = BankPageNumberPagination

filter_backends =(filters.DjangoFilterBackend,SearchFilter,OrderingFilter)
filterset_fields = ("bank_name",'bank_id','district','state','branch','ifsc','city','address')
search_fields = ["bank_name",'bank_id','district','state','branch','ifsc','city','address']
5 changes: 5 additions & 0 deletions ifscfinder/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class IfscfinderConfig(AppConfig):
name = 'ifscfinder'
29 changes: 29 additions & 0 deletions ifscfinder/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.0.8 on 2020-07-02 05:38

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Bank',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=40)),
('ifsc', models.CharField(max_length=11)),
('micr_code', models.CharField(max_length=9)),
('branch', models.CharField(max_length=30)),
('address', models.CharField(max_length=200)),
('contact', models.CharField(max_length=10)),
('city', models.CharField(max_length=20)),
('district', models.CharField(max_length=20)),
('state', models.CharField(max_length=20)),
],
),
]
19 changes: 19 additions & 0 deletions ifscfinder/migrations/0002_auto_20200702_1107.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.0.8 on 2020-07-02 11:07

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

dependencies = [
('ifscfinder', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='bank',
name='id',
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False),
),
]
22 changes: 22 additions & 0 deletions ifscfinder/migrations/0003_auto_20200702_1118.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.0.8 on 2020-07-02 11:18

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('ifscfinder', '0002_auto_20200702_1107'),
]

operations = [
migrations.RenameField(
model_name='bank',
old_name='name',
new_name='bank_name',
),
migrations.RemoveField(
model_name='bank',
name='micr_code',
),
]
21 changes: 21 additions & 0 deletions ifscfinder/migrations/0004_auto_20200702_1143.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.0.8 on 2020-07-02 11:43

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('ifscfinder', '0003_auto_20200702_1118'),
]

operations = [
migrations.RemoveField(
model_name='bank',
name='city',
),
migrations.RemoveField(
model_name='bank',
name='contact',
),
]
18 changes: 18 additions & 0 deletions ifscfinder/migrations/0005_auto_20200702_1218.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.8 on 2020-07-02 12:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('ifscfinder', '0004_auto_20200702_1143'),
]

operations = [
migrations.AlterField(
model_name='bank',
name='id',
field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
]
Loading

0 comments on commit 4e63fae

Please sign in to comment.