├── CRUDapp ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_auto_20191107_0734.py │ └── 0001_initial.py ├── tests.py ├── admin.py ├── apps.py ├── models.py ├── serializers.py ├── form.py └── views.py ├── DjangoCRUDwithMySQL ├── __init__.py ├── wsgi.py ├── urls.py └── settings.py ├── .gitignore ├── venv └── lib │ └── python3.7 │ └── site-packages │ ├── rest_framework │ ├── utils │ │ ├── __init__.py │ │ ├── urls.py │ │ ├── json.py │ │ ├── humanize_datetime.py │ │ ├── breadcrumbs.py │ │ ├── html.py │ │ ├── encoders.py │ │ ├── mediatypes.py │ │ ├── formatting.py │ │ ├── representation.py │ │ └── serializer_helpers.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── generateschema.py │ ├── templatetags │ │ └── __init__.py │ ├── authtoken │ │ ├── management │ │ │ ├── __init__.py │ │ │ └── commands │ │ │ │ ├── __init__.py │ │ │ │ └── drf_create_token.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ ├── 0001_initial.py │ │ │ └── 0002_auto_20160226_1747.py │ │ ├── __init__.py │ │ ├── apps.py │ │ ├── admin.py │ │ ├── models.py │ │ ├── serializers.py │ │ └── views.py │ ├── templates │ │ └── rest_framework │ │ │ ├── inline │ │ │ ├── list_fieldset.html │ │ │ ├── form.html │ │ │ ├── fieldset.html │ │ │ ├── list_field.html │ │ │ ├── dict_field.html │ │ │ ├── checkbox.html │ │ │ ├── textarea.html │ │ │ ├── input.html │ │ │ ├── checkbox_multiple.html │ │ │ ├── radio.html │ │ │ ├── select.html │ │ │ └── select_multiple.html │ │ │ ├── api.html │ │ │ ├── login.html │ │ │ ├── admin │ │ │ ├── simple_list_value.html │ │ │ ├── dict_value.html │ │ │ ├── list_value.html │ │ │ ├── detail.html │ │ │ └── list.html │ │ │ ├── schema.js │ │ │ ├── horizontal │ │ │ ├── form.html │ │ │ ├── list_field.html │ │ │ ├── dict_field.html │ │ │ ├── list_fieldset.html │ │ │ ├── fieldset.html │ │ │ ├── checkbox.html │ │ │ ├── textarea.html │ │ │ ├── input.html │ │ │ ├── checkbox_multiple.html │ │ │ ├── select.html │ │ │ ├── select_multiple.html │ │ │ └── radio.html │ │ │ ├── vertical │ │ │ ├── form.html │ │ │ ├── list_fieldset.html │ │ │ ├── list_field.html │ │ │ ├── dict_field.html │ │ │ ├── fieldset.html │ │ │ ├── checkbox.html │ │ │ ├── textarea.html │ │ │ ├── input.html │ │ │ ├── select.html │ │ │ ├── checkbox_multiple.html │ │ │ ├── select_multiple.html │ │ │ └── radio.html │ │ │ ├── docs │ │ │ ├── langs │ │ │ │ ├── python-intro.html │ │ │ │ ├── shell-intro.html │ │ │ │ ├── javascript-intro.html │ │ │ │ ├── shell.html │ │ │ │ ├── python.html │ │ │ │ └── javascript.html │ │ │ ├── document.html │ │ │ ├── auth │ │ │ │ ├── session.html │ │ │ │ ├── basic.html │ │ │ │ └── token.html │ │ │ ├── interact.html │ │ │ ├── error.html │ │ │ ├── index.html │ │ │ ├── sidebar.html │ │ │ └── link.html │ │ │ ├── raw_data_form.html │ │ │ ├── filters │ │ │ ├── search.html │ │ │ ├── ordering.html │ │ │ └── base.html │ │ │ ├── pagination │ │ │ ├── previous_and_next.html │ │ │ └── numbers.html │ │ │ └── login_base.html │ ├── locale │ │ ├── ach │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ar │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── be │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ca │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── cs │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── da │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── de │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── el │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── en │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── es │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── et │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── fa │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── fi │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── fr │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── gl │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── hu │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── id │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── it │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ja │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── lv │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── mk │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── nb │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── nl │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── nn │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── no │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── pl │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── pt │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ro │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ru │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── sk │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── sl │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── sv │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── tr │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── uk │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── vi │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ca_ES │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── el_GR │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── en_AU │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── en_CA │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── en_US │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── fa_IR │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── fr_CA │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── gl_ES │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── he_IL │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── ko_KR │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── pt_BR │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── pt_PT │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── tr_TR │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── zh_CN │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── zh_TW │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ ├── zh_Hans │ │ │ └── LC_MESSAGES │ │ │ │ └── django.mo │ │ └── zh_Hant │ │ │ └── LC_MESSAGES │ │ │ └── django.mo │ ├── static │ │ └── rest_framework │ │ │ ├── img │ │ │ ├── grid.png │ │ │ ├── glyphicons-halflings.png │ │ │ └── glyphicons-halflings-white.png │ │ │ ├── docs │ │ │ ├── img │ │ │ │ ├── grid.png │ │ │ │ └── favicon.ico │ │ │ ├── css │ │ │ │ ├── jquery.json-view.min.css │ │ │ │ └── highlight.css │ │ │ └── js │ │ │ │ └── jquery.json-view.min.js │ │ │ ├── fonts │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ ├── css │ │ │ ├── prettify.css │ │ │ ├── default.css │ │ │ └── bootstrap-tweaks.css │ │ │ └── js │ │ │ ├── default.js │ │ │ ├── csrf.js │ │ │ └── ajax-form.js │ ├── apps.py │ ├── urls.py │ ├── checks.py │ ├── __init__.py │ ├── schemas │ │ ├── utils.py │ │ ├── __init__.py │ │ ├── views.py │ │ └── inspectors.py │ ├── reverse.py │ ├── status.py │ ├── mixins.py │ ├── documentation.py │ ├── response.py │ ├── negotiation.py │ └── urlpatterns.py │ └── djangorestframework-3.11.0.dist-info │ ├── INSTALLER │ ├── top_level.txt │ ├── WHEEL │ └── LICENSE.md ├── .idea ├── .gitignore ├── vcs.xml ├── inspectionProfiles │ └── profiles_settings.xml ├── modules.xml ├── misc.xml ├── dataSources.xml └── DjangoCRUDwithMySQL.iml ├── README.md ├── templates ├── base.html └── index.html ├── manage.py └── static └── script.js /CRUDapp/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CRUDapp/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DjangoCRUDwithMySQL/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CRUDapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/djangorestframework-3.11.0.dist-info/INSTALLER: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /CRUDapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/djangorestframework-3.11.0.dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | rest_framework 2 | -------------------------------------------------------------------------------- /CRUDapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CrudappConfig(AppConfig): 5 | name = 'CRUDapp' 6 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/__init__.py: -------------------------------------------------------------------------------- 1 | default_app_config = 'rest_framework.authtoken.apps.AuthTokenConfig' 2 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml 3 | # Datasource local storage ignored files 4 | /dataSources/ 5 | /dataSources.local.xml 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DjangoCRUDwithMySQL 2 | Simple Application to demonstrate Create, Read, Update and Delete Operation using MySQL Database by @akshatsoni64 3 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/list_fieldset.html: -------------------------------------------------------------------------------- 1 | Lists are not currently supported in HTML input. 2 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/djangorestframework-3.11.0.dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: bdist_wheel (0.33.6) 3 | Root-Is-Purelib: true 4 | Tag: py3-none-any 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/api.html: -------------------------------------------------------------------------------- 1 | {% extends "rest_framework/base.html" %} 2 | 3 | {# Override this template in your own templates directory to customize #} 4 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/login.html: -------------------------------------------------------------------------------- 1 | {% extends "rest_framework/login_base.html" %} 2 | 3 | {# Override this template in your own templates directory to customize #} 4 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ach/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ach/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ar/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ar/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/be/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/be/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ca/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ca/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/cs/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/cs/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/da/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/da/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/de/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/de/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/el/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/el/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/en/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/en/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/es/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/es/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/et/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/et/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/fa/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/fa/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/fi/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/fi/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/fr/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/fr/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/gl/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/gl/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/hu/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/hu/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/id/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/id/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/it/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/it/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ja/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ja/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/lv/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/lv/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/mk/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/mk/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/nb/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/nb/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/nl/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/nl/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/nn/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/nn/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/no/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/no/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/pl/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/pl/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/pt/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/pt/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ro/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ro/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ru/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ru/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/sk/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/sk/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/sl/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/sl/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/sv/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/sv/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/tr/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/tr/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/uk/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/uk/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/vi/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/vi/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ca_ES/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ca_ES/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/el_GR/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/el_GR/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/en_AU/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/en_AU/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/en_CA/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/en_CA/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/en_US/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/en_US/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/fa_IR/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/fa_IR/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/fr_CA/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/fr_CA/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/gl_ES/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/gl_ES/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/he_IL/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/he_IL/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/ko_KR/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/ko_KR/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/pt_PT/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/pt_PT/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/tr_TR/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/tr_TR/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/zh_CN/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/zh_CN/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/zh_TW/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/zh_TW/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/img/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/img/grid.png -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/admin/simple_list_value.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% for item in value %}{% if not forloop.first%},{% endif %} {{item|format_value}}{% endfor %} 3 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/schema.js: -------------------------------------------------------------------------------- 1 | var codec = new window.coreapi.codecs.CoreJSONCodec() 2 | var coreJSON = window.atob('{{ schema }}') 3 | window.schema = codec.decode(coreJSON) 4 | -------------------------------------------------------------------------------- /CRUDapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Student(models.Model): 5 | name = models.CharField(max_length=30) 6 | branch = models.CharField(max_length=20) 7 | eno = models.CharField(max_length=10) 8 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/zh_Hans/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/zh_Hans/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/locale/zh_Hant/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/locale/zh_Hant/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/img/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/img/grid.png -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/img/favicon.ico -------------------------------------------------------------------------------- /CRUDapp/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | from . import models 3 | 4 | 5 | class StudentSerializer(serializers.ModelSerializer): 6 | class Meta: 7 | model = models.Student 8 | fields = ('name', 'branch', 'eno') 9 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/form.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% for field in form %} 3 | {% if not field.read_only %} 4 | {% render_field field style=style %} 5 | {% endif %} 6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/form.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% for field in form %} 3 | {% if not field.read_only %} 4 | {% render_field field style=style %} 5 | {% endif %} 6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/form.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% for field in form %} 3 | {% if not field.read_only %} 4 | {% render_field field style=style %} 5 | {% endif %} 6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akshatsoni64/DjangoCRUDwithMySQL/HEAD/venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/fieldset.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% for nested_field in field %} 3 | {% if not nested_field.read_only %} 4 | {% render_field nested_field style=style %} 5 | {% endif %} 6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | from django.utils.translation import gettext_lazy as _ 3 | 4 | 5 | class AuthTokenConfig(AppConfig): 6 | name = 'rest_framework.authtoken' 7 | verbose_name = _("Auth Token") 8 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/langs/python-intro.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
{% code bash %}# Install the Python client library
3 | $ pip install coreapi{% endcode %}
4 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/langs/shell-intro.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
{% code bash %}# Install the command line client
3 | $ pip install coreapi-cli{% endcode %}
4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class RestFrameworkConfig(AppConfig): 5 | name = 'rest_framework' 6 | verbose_name = "Django REST framework" 7 | 8 | def ready(self): 9 | # Add System checks 10 | from .checks import pagination_system_check # NOQA 11 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/list_field.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |

Lists are not currently supported in HTML input.

9 |
10 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/list_fieldset.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 4 | {{ field.label }} 5 | 6 | {% endif %} 7 | 8 |

Lists are not currently supported in HTML input.

9 |
10 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/dict_field.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |

Dictionaries are not currently supported in HTML input.

9 |
10 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/list_field.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 4 | {% endif %} 5 | 6 |

Lists are not currently supported in HTML input.

7 |
8 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/dict_field.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 4 | {% endif %} 5 | 6 |

Dictionaries are not currently supported in HTML input.

7 |
8 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from rest_framework.authtoken.models import Token 4 | 5 | 6 | class TokenAdmin(admin.ModelAdmin): 7 | list_display = ('key', 'user', 'created') 8 | fields = ('user',) 9 | ordering = ('-created',) 10 | 11 | 12 | admin.site.register(Token, TokenAdmin) 13 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/admin/dict_value.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | {% for k, v in value|items %} 5 | 6 | 7 | 8 | 9 | {% endfor %} 10 | 11 |
{{ k|format_value }}{{ v|format_value }}
12 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/admin/list_value.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | {% for item in value %} 5 | 6 | 7 | 8 | 9 | {% endfor %} 10 | 11 |
{{ forloop.counter0 }}{{ item|format_value }}
12 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/checkbox.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/admin/detail.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | {% for key, value in results|items %} 5 | {% if key in details %} 6 | 7 | {% endif %} 8 | {% endfor %} 9 | 10 |
{{ key|capfirst }}{{ value|format_value }}
11 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/langs/javascript-intro.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% load static %} 3 |
{% code html %}
4 | 
5 | {% endcode %}
6 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/list_field.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |
9 |

Lists are not currently supported in HTML input.

10 |
11 |
12 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/dict_field.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |
9 |

Dictionaries are not currently supported in HTML input.

10 |
11 |
12 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/raw_data_form.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {{ form.non_field_errors }} 3 | {% for field in form %} 4 |
5 | {{ field.label_tag|add_class:"col-sm-2 control-label" }} 6 |
7 | {{ field|add_class:"form-control" }} 8 | {{ field.help_text|safe }} 9 |
10 |
11 | {% endfor %} 12 | -------------------------------------------------------------------------------- /CRUDapp/migrations/0002_auto_20191107_0734.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.7 on 2019-11-07 07:34 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('CRUDapp', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='student', 15 | name='eno', 16 | field=models.CharField(max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/textarea.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/fieldset.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 6 | {{ field.label }} 7 | 8 | {% endif %} 9 | 10 | {% for nested_field in field %} 11 | {% if not nested_field.read_only %} 12 | {% render_field nested_field style=style %} 13 | {% endif %} 14 | {% endfor %} 15 |
16 | -------------------------------------------------------------------------------- /DjangoCRUDwithMySQL/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for DjangoCRUDwithMySQL 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/2.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', 'DjangoCRUDwithMySQL.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/list_fieldset.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 |
6 | 7 | {{ field.label }} 8 | 9 |
10 | {% endif %} 11 | 12 |

Lists are not currently supported in HTML input.

13 |
14 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/langs/shell.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
{% code bash %}# Load the schema document
3 | $ coreapi get {{ document.url }}{% if schema_format %} --format {{ schema_format }}{% endif %}
4 | 
5 | # Interact with the API endpoint
6 | $ coreapi action {% if section_key %}{{ section_key }} {% endif %}{{ link_key|cut:"> " }}{% for field in link.fields %} -p {{ field.name }}=...{% endfor %}{% endcode %}
7 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/filters/search.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |

{% trans "Search" %}

3 |
4 |
5 |
6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | CRUD App Django 7 | 8 | 9 | 10 |

Students:

11 | 12 |

Registration Form:

13 | {% block form %} 14 | {% endblock %} 15 | 16 |

List of Students:

17 | {% block entries %} 18 | {% endblock %} 19 | 20 | 21 | 22 | {% block edit %} 23 | {% endblock %} -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/fieldset.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
3 | {% if field.label %} 4 |
5 | 6 | {{ field.label }} 7 | 8 |
9 | {% endif %} 10 | 11 | {% for nested_field in field %} 12 | {% if not nested_field.read_only %} 13 | {% render_field nested_field style=style %} 14 | {% endif %} 15 | {% endfor %} 16 |
17 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql.8 6 | true 7 | true 8 | $PROJECT_DIR$/DjangoCRUDwithMySQL/settings.py 9 | com.mysql.cj.jdbc.Driver 10 | jdbc:mysql://127.0.0.1:3306/students 11 | 12 | 13 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/input.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/pagination/previous_and_next.html: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/checkbox_multiple.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 6 | {% endif %} 7 | 8 | {% for key, text in field.choices|items %} 9 |
10 | 14 |
15 | {% endfor %} 16 |
17 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/filters/ordering.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | {% load i18n %} 3 |

{% trans "Ordering" %}

4 |
5 | {% for key, label in options %} 6 | {% if key == current %} 7 | 8 | {{ label }} 9 | 10 | {% else %} 11 | {{ label }} 12 | {% endif %} 13 | {% endfor %} 14 |
15 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/checkbox.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 | 9 | {% if field.errors %} 10 | {% for error in field.errors %} 11 | {{ error }} 12 | {% endfor %} 13 | {% endif %} 14 | 15 | {% if field.help_text %} 16 | {{ field.help_text|safe }} 17 | {% endif %} 18 |
19 | -------------------------------------------------------------------------------- /CRUDapp/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.7 on 2019-11-07 06:49 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 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=30)), 19 | ('branch', models.CharField(max_length=20)), 20 | ('eno', models.TextField(max_length=10)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoCRUDwithMySQL.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/filters/base.html: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | Login and logout views for the browsable API. 3 | 4 | Add these to your root URLconf if you're using the browsable API and 5 | your API requires authentication: 6 | 7 | urlpatterns = [ 8 | ... 9 | url(r'^auth/', include('rest_framework.urls')) 10 | ] 11 | 12 | You should make sure your authentication settings include `SessionAuthentication`. 13 | """ 14 | from django.conf.urls import url 15 | from django.contrib.auth import views 16 | 17 | app_name = 'rest_framework' 18 | urlpatterns = [ 19 | url(r'^login/$', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'), 20 | url(r'^logout/$', views.LogoutView.as_view(), name='logout'), 21 | ] 22 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/langs/python.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
{% code python %}import coreapi
 3 | 
 4 | # Initialize a client & load the schema document
 5 | client = coreapi.Client()
 6 | schema = client.get("{{ document.url }}"{% if schema_format %}, format="{{ schema_format }}"{% endif %})
 7 | 
 8 | # Interact with the API endpoint
 9 | action = [{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"]
10 | {% if link.fields %}params = {
11 | {% for field in link.fields %}    "{{ field.name }}": ...{% if not loop.last %},{% endif %}
12 | {% endfor %}}
13 | {% endif %}result = client.action(schema, action{% if link.fields %}, params=params{% endif %}){% endcode %}
14 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/checkbox.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |
9 | 10 | 11 | {% if field.errors %} 12 | {% for error in field.errors %} 13 | {{ error }} 14 | {% endfor %} 15 | {% endif %} 16 | 17 | {% if field.help_text %} 18 | {{ field.help_text|safe }} 19 | {% endif %} 20 |
21 |
22 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/textarea.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 | 9 | 10 | {% if field.errors %} 11 | {% for error in field.errors %}{{ error }}{% endfor %} 12 | {% endif %} 13 | 14 | {% if field.help_text %} 15 | {{ field.help_text|safe }} 16 | {% endif %} 17 |
18 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/langs/javascript.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
{% code javascript %}var coreapi = window.coreapi  // Loaded by `coreapi.js`
 3 | var schema = window.schema    // Loaded by `schema.js`
 4 | 
 5 | // Initialize a client
 6 | var client = new coreapi.Client()
 7 | 
 8 | // Interact with the API endpoint
 9 | var action = [{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"]
10 | {% if link.fields %}var params = {
11 | {% for field in link.fields %}    {{ field.name }}: ...{% if not loop.last %},{% endif %}
12 | {% endfor %}}
13 | {% endif %}client.action(schema, action{% if link.fields %}, params{% endif %}).then(function(result) {
14 |     // Return value is in 'result'
15 | }){% endcode %}
16 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import migrations, models 3 | 4 | 5 | class Migration(migrations.Migration): 6 | 7 | dependencies = [ 8 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 9 | ] 10 | 11 | operations = [ 12 | migrations.CreateModel( 13 | name='Token', 14 | fields=[ 15 | ('key', models.CharField(primary_key=True, serialize=False, max_length=40)), 16 | ('created', models.DateTimeField(auto_now_add=True)), 17 | ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, related_name='auth_token', on_delete=models.CASCADE)), 18 | ], 19 | options={ 20 | }, 21 | bases=(models.Model,), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/input.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 4 | {% endif %} 5 | 6 | 7 | 8 | {% if field.errors %} 9 | {% for error in field.errors %} 10 | {{ error }} 11 | {% endfor %} 12 | {% endif %} 13 | 14 | {% if field.help_text %} 15 | {{ field.help_text|safe }} 16 | {% endif %} 17 |
18 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/textarea.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |
9 | 10 | 11 | {% if field.errors %} 12 | {% for error in field.errors %} 13 | {{ error }} 14 | {% endfor %} 15 | {% endif %} 16 | 17 | {% if field.help_text %} 18 | {{ field.help_text|safe }} 19 | {% endif %} 20 |
21 |
22 | -------------------------------------------------------------------------------- /CRUDapp/form.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Student 3 | 4 | 5 | class StudentForm(forms.ModelForm): 6 | name = forms.CharField(widget=forms.TextInput( 7 | attrs={ 8 | 'id': "nameStudent", 9 | 'name': "name", 10 | 'max_length': '30', 11 | 'placeholder': 'Name Here...' 12 | } 13 | )) 14 | branch = forms.CharField(widget=forms.TextInput( 15 | attrs={ 16 | 'id': "branchStudent", 17 | 'name': "branch", 18 | 'max_length': '20', 19 | 'placeholder': 'Branch Here...' 20 | } 21 | )) 22 | eno = forms.CharField(widget=forms.TextInput( 23 | attrs={ 24 | 'id': "enoStudent", 25 | 'name': "eno", 26 | 'max_length': '10', 27 | 'placeholder': 'Enrollment Number Here...' 28 | } 29 | )) 30 | 31 | class Meta: 32 | model = Student 33 | fields = '__all__' 34 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/radio.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load rest_framework %} 3 | {% trans "None" as none_choice %} 4 | 5 |
6 | {% if field.label %} 7 | 10 | {% endif %} 11 | 12 | {% if field.allow_null or field.allow_blank %} 13 |
14 | 18 |
19 | {% endif %} 20 | 21 | {% for key, text in field.choices|items %} 22 |
23 | 27 |
28 | {% endfor %} 29 |
30 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/admin/list.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | {% for column in columns%}{% endfor %} 5 | 6 | 7 | {% for row in results %} 8 | 9 | {% for key, value in row|items %} 10 | {% if key in columns %} 11 | 14 | {% endif %} 15 | {% endfor %} 16 | 23 | 24 | {% endfor %} 25 | 26 |
{{ column|capfirst }}
12 | {{ value|format_value }} 13 | 17 | {% if row.url %} 18 | 19 | {% else %} 20 | 21 | {% endif %} 22 |
27 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/css/prettify.css: -------------------------------------------------------------------------------- 1 | .com { color: #93a1a1; } 2 | .lit { color: #195f91; } 3 | .pun, .opn, .clo { color: #93a1a1; } 4 | .fun { color: #dc322f; } 5 | .str, .atv { color: #D14; } 6 | .kwd, .prettyprint .tag { color: #1e347b; } 7 | .typ, .atn, .dec, .var { color: teal; } 8 | .pln { color: #48484c; } 9 | 10 | .prettyprint { 11 | padding: 8px; 12 | background-color: #f7f7f9; 13 | border: 1px solid #e1e1e8; 14 | } 15 | .prettyprint.linenums { 16 | -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 17 | -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 18 | box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 19 | } 20 | 21 | /* Specify class=linenums on a pre to get line numbering */ 22 | ol.linenums { 23 | margin: 0 0 0 33px; /* IE indents via margin-left */ 24 | } 25 | ol.linenums li { 26 | padding-left: 12px; 27 | color: #bebec5; 28 | line-height: 20px; 29 | text-shadow: 0 1px 0 #fff; 30 | } -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/input.html: -------------------------------------------------------------------------------- 1 |
2 | {% if field.label %} 3 | 6 | {% endif %} 7 | 8 |
9 | 10 | 11 | {% if field.errors %} 12 | {% for error in field.errors %} 13 | {{ error }} 14 | {% endfor %} 15 | {% endif %} 16 | 17 | {% if field.help_text %} 18 | {{ field.help_text|safe }} 19 | {% endif %} 20 |
21 |
22 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/select.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 8 | {% endif %} 9 | 10 | 24 |
25 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/checks.py: -------------------------------------------------------------------------------- 1 | from django.core.checks import Tags, Warning, register 2 | 3 | 4 | @register(Tags.compatibility) 5 | def pagination_system_check(app_configs, **kwargs): 6 | errors = [] 7 | # Use of default page size setting requires a default Paginator class 8 | from rest_framework.settings import api_settings 9 | if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS: 10 | errors.append( 11 | Warning( 12 | "You have specified a default PAGE_SIZE pagination rest_framework setting," 13 | "without specifying also a DEFAULT_PAGINATION_CLASS.", 14 | hint="The default for DEFAULT_PAGINATION_CLASS is None. " 15 | "In previous versions this was PageNumberPagination. " 16 | "If you wish to define PAGE_SIZE globally whilst defining " 17 | "pagination_class on a per-view basis you may silence this check.", 18 | id="rest_framework.W001" 19 | ) 20 | ) 21 | return errors 22 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/inline/select_multiple.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load rest_framework %} 3 | {% trans "No items to select." as no_items %} 4 | 5 |
6 | {% if field.label %} 7 | 10 | {% endif %} 11 | 12 | 25 |
26 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/document.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 |
5 |

{{ document.title }}

6 | {% if document.description %} 7 |

{% render_markdown document.description %}

8 | {% endif %} 9 |
10 |
11 | {% for html in lang_intro_htmls %} 12 | {% include html %} 13 | {% endfor %} 14 |
15 |
16 | {% if document|data %} 17 | {% for section_key, section in document|data|items %} 18 | {% if section_key %} 19 |

{{ section_key }} 20 |

21 | {% endif %} 22 | 23 | {% for link_key, link in section|schema_links|items %} 24 | {% include "rest_framework/docs/link.html" %} 25 | {% endfor %} 26 | {% endfor %} 27 | 28 | {% for link_key, link in document.links|items %} 29 | {% include "rest_framework/docs/link.html" %} 30 | {% endfor %} 31 | {% endif %} 32 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/__init__.py: -------------------------------------------------------------------------------- 1 | r""" 2 | ______ _____ _____ _____ __ 3 | | ___ \ ___/ ___|_ _| / _| | | 4 | | |_/ / |__ \ `--. | | | |_ _ __ __ _ _ __ ___ _____ _____ _ __| |__ 5 | | /| __| `--. \ | | | _| '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ / 6 | | |\ \| |___/\__/ / | | | | | | | (_| | | | | | | __/\ V V / (_) | | | < 7 | \_| \_\____/\____/ \_/ |_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_| 8 | """ 9 | 10 | __title__ = 'Django REST framework' 11 | __version__ = '3.11.0' 12 | __author__ = 'Tom Christie' 13 | __license__ = 'BSD 3-Clause' 14 | __copyright__ = 'Copyright 2011-2019 Encode OSS Ltd' 15 | 16 | # Version synonym 17 | VERSION = __version__ 18 | 19 | # Header encoding (see RFC5987) 20 | HTTP_HEADER_ENCODING = 'iso-8859-1' 21 | 22 | # Default datetime input and output formats 23 | ISO_8601 = 'iso-8601' 24 | 25 | default_app_config = 'rest_framework.apps.RestFrameworkConfig' 26 | 27 | 28 | class RemovedInDRF312Warning(DeprecationWarning): 29 | pass 30 | 31 | 32 | class RemovedInDRF313Warning(PendingDeprecationWarning): 33 | pass 34 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block form %} 4 |
5 | {% csrf_token %} 6 | {{ form.as_p }} 7 | 8 | 9 |
10 | {% endblock %} 11 | {% block entries %} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% for entry in studentdata %} 20 | 21 | 22 | 23 | 24 | 28 | 29 | {% endfor %} 30 |
Eno.NameBranchAction
{{ entry.eno }}{{ entry.name }}{{ entry.branch }} 25 | 26 | 27 |
31 | {% endblock %} -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/migrations/0002_auto_20160226_1747.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import migrations, models 3 | 4 | 5 | class Migration(migrations.Migration): 6 | 7 | dependencies = [ 8 | ('authtoken', '0001_initial'), 9 | ] 10 | 11 | operations = [ 12 | migrations.AlterModelOptions( 13 | name='token', 14 | options={'verbose_name_plural': 'Tokens', 'verbose_name': 'Token'}, 15 | ), 16 | migrations.AlterField( 17 | model_name='token', 18 | name='created', 19 | field=models.DateTimeField(verbose_name='Created', auto_now_add=True), 20 | ), 21 | migrations.AlterField( 22 | model_name='token', 23 | name='key', 24 | field=models.CharField(verbose_name='Key', max_length=40, primary_key=True, serialize=False), 25 | ), 26 | migrations.AlterField( 27 | model_name='token', 28 | name='user', 29 | field=models.OneToOneField(to=settings.AUTH_USER_MODEL, verbose_name='User', related_name='auth_token', on_delete=models.CASCADE), 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /DjangoCRUDwithMySQL/urls.py: -------------------------------------------------------------------------------- 1 | """DjangoCRUDwithMySQL URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | import CRUDapp.views as CRUD 19 | 20 | urlpatterns = [ 21 | path('index/', CRUD.CRUDOps.as_view(), name='index'), 22 | path('index/insert/', CRUD.CRUDOps.as_view(), name="index"), 23 | path('index/insert/', CRUD.CRUDOps.as_view(), name="index"), 24 | path('index/update/', CRUD.CRUDOps.as_view(), name="update"), 25 | path('index/delete/', CRUD.CRUDOps.as_view(), name="delete") 26 | ] 27 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/urls.py: -------------------------------------------------------------------------------- 1 | from urllib import parse 2 | 3 | from django.utils.encoding import force_str 4 | 5 | 6 | def replace_query_param(url, key, val): 7 | """ 8 | Given a URL and a key/val pair, set or replace an item in the query 9 | parameters of the URL, and return the new URL. 10 | """ 11 | (scheme, netloc, path, query, fragment) = parse.urlsplit(force_str(url)) 12 | query_dict = parse.parse_qs(query, keep_blank_values=True) 13 | query_dict[force_str(key)] = [force_str(val)] 14 | query = parse.urlencode(sorted(list(query_dict.items())), doseq=True) 15 | return parse.urlunsplit((scheme, netloc, path, query, fragment)) 16 | 17 | 18 | def remove_query_param(url, key): 19 | """ 20 | Given a URL and a key/val pair, remove an item in the query 21 | parameters of the URL, and return the new URL. 22 | """ 23 | (scheme, netloc, path, query, fragment) = parse.urlsplit(force_str(url)) 24 | query_dict = parse.parse_qs(query, keep_blank_values=True) 25 | query_dict.pop(key, None) 26 | query = parse.urlencode(sorted(list(query_dict.items())), doseq=True) 27 | return parse.urlunsplit((scheme, netloc, path, query, fragment)) 28 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/json.py: -------------------------------------------------------------------------------- 1 | """ 2 | Wrapper for the builtin json module that ensures compliance with the JSON spec. 3 | 4 | REST framework should always import this wrapper module in order to maintain 5 | spec-compliant encoding/decoding. Support for non-standard features should be 6 | handled by users at the renderer and parser layer. 7 | """ 8 | import functools 9 | import json # noqa 10 | 11 | 12 | def strict_constant(o): 13 | raise ValueError('Out of range float values are not JSON compliant: ' + repr(o)) 14 | 15 | 16 | @functools.wraps(json.dump) 17 | def dump(*args, **kwargs): 18 | kwargs.setdefault('allow_nan', False) 19 | return json.dump(*args, **kwargs) 20 | 21 | 22 | @functools.wraps(json.dumps) 23 | def dumps(*args, **kwargs): 24 | kwargs.setdefault('allow_nan', False) 25 | return json.dumps(*args, **kwargs) 26 | 27 | 28 | @functools.wraps(json.load) 29 | def load(*args, **kwargs): 30 | kwargs.setdefault('parse_constant', strict_constant) 31 | return json.load(*args, **kwargs) 32 | 33 | 34 | @functools.wraps(json.loads) 35 | def loads(*args, **kwargs): 36 | kwargs.setdefault('parse_constant', strict_constant) 37 | return json.loads(*args, **kwargs) 38 | -------------------------------------------------------------------------------- /.idea/DjangoCRUDwithMySQL.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/auth/session.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | 36 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/select.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 8 | {% endif %} 9 | 10 | 24 | 25 | {% if field.errors %} 26 | {% for error in field.errors %} 27 | {{ error }} 28 | {% endfor %} 29 | {% endif %} 30 | 31 | {% if field.help_text %} 32 | {{ field.help_text|safe }} 33 | {% endif %} 34 |
35 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/checkbox_multiple.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 6 | {% endif %} 7 | 8 | {% if style.inline %} 9 |
10 | {% for key, text in field.choices|items %} 11 | 15 | {% endfor %} 16 |
17 | {% else %} 18 | {% for key, text in field.choices|items %} 19 |
20 | 24 |
25 | {% endfor %} 26 | {% endif %} 27 | 28 | {% if field.errors %} 29 | {% for error in field.errors %} 30 | {{ error }} 31 | {% endfor %} 32 | {% endif %} 33 | 34 | {% if field.help_text %} 35 | {{ field.help_text|safe }} 36 | {% endif %} 37 |
38 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/select_multiple.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load rest_framework %} 3 | {% trans "No items to select." as no_items %} 4 | 5 |
6 | {% if field.label %} 7 | 10 | {% endif %} 11 | 12 | 25 | 26 | {% if field.errors %} 27 | {% for error in field.errors %}{{ error }}{% endfor %} 28 | {% endif %} 29 | 30 | {% if field.help_text %} 31 | {{ field.help_text|safe }} 32 | {% endif %} 33 |
34 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/models.py: -------------------------------------------------------------------------------- 1 | import binascii 2 | import os 3 | 4 | from django.conf import settings 5 | from django.db import models 6 | from django.utils.translation import gettext_lazy as _ 7 | 8 | 9 | class Token(models.Model): 10 | """ 11 | The default authorization token model. 12 | """ 13 | key = models.CharField(_("Key"), max_length=40, primary_key=True) 14 | user = models.OneToOneField( 15 | settings.AUTH_USER_MODEL, related_name='auth_token', 16 | on_delete=models.CASCADE, verbose_name=_("User") 17 | ) 18 | created = models.DateTimeField(_("Created"), auto_now_add=True) 19 | 20 | class Meta: 21 | # Work around for a bug in Django: 22 | # https://code.djangoproject.com/ticket/19422 23 | # 24 | # Also see corresponding ticket: 25 | # https://github.com/encode/django-rest-framework/issues/705 26 | abstract = 'rest_framework.authtoken' not in settings.INSTALLED_APPS 27 | verbose_name = _("Token") 28 | verbose_name_plural = _("Tokens") 29 | 30 | def save(self, *args, **kwargs): 31 | if not self.key: 32 | self.key = self.generate_key() 33 | return super().save(*args, **kwargs) 34 | 35 | def generate_key(self): 36 | return binascii.hexlify(os.urandom(20)).decode() 37 | 38 | def __str__(self): 39 | return self.key 40 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/css/jquery.json-view.min.css: -------------------------------------------------------------------------------- 1 | .json-view{position:relative} 2 | .json-view .collapser{width:20px;height:18px;display:block;position:absolute;left:-1.7em;top:-.2em;z-index:5;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD1JREFUeNpiYGBgOADE%2F3Hgw0DM4IRHgSsDFOzFInmMAQnY49ONzZRjDFiADT7dMLALiE8y4AGW6LoBAgwAuIkf%2F%2FB7O9sAAAAASUVORK5CYII%3D);background-repeat:no-repeat;background-position:center center;opacity:.5;cursor:pointer} 3 | .json-view .collapsed{-ms-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-khtml-transform:rotate(-90deg);-webkit-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)} 4 | .json-view .bl{display:block;padding-left:20px;margin-left:-20px;position:relative} 5 | .json-view{font-family:monospace} 6 | .json-view ul{list-style-type:none;padding-left:2em;border-left:1px dotted;margin:.3em} 7 | .json-view ul li{position:relative} 8 | .json-view .comments,.json-view .dots{display:none;-moz-user-select:none;-ms-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none} 9 | .json-view .comments{padding-left:.8em;font-style:italic;color:#888} 10 | .json-view .bool,.json-view .null,.json-view .num,.json-view .undef{font-weight:700;color:#1A01CC} 11 | .json-view .str{color:#800} -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/schemas/utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | utils.py # Shared helper functions 3 | 4 | See schemas.__init__.py for package overview. 5 | """ 6 | from django.db import models 7 | from django.utils.translation import gettext_lazy as _ 8 | 9 | from rest_framework.mixins import RetrieveModelMixin 10 | 11 | 12 | def is_list_view(path, method, view): 13 | """ 14 | Return True if the given path/method appears to represent a list view. 15 | """ 16 | if hasattr(view, 'action'): 17 | # Viewsets have an explicitly defined action, which we can inspect. 18 | return view.action == 'list' 19 | 20 | if method.lower() != 'get': 21 | return False 22 | if isinstance(view, RetrieveModelMixin): 23 | return False 24 | path_components = path.strip('/').split('/') 25 | if path_components and '{' in path_components[-1]: 26 | return False 27 | return True 28 | 29 | 30 | def get_pk_description(model, model_field): 31 | if isinstance(model_field, models.AutoField): 32 | value_type = _('unique integer value') 33 | elif isinstance(model_field, models.UUIDField): 34 | value_type = _('UUID string') 35 | else: 36 | value_type = _('unique value') 37 | 38 | return _('A {value_type} identifying this {name}.').format( 39 | value_type=value_type, 40 | name=model._meta.verbose_name, 41 | ) 42 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/serializers.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import authenticate 2 | from django.utils.translation import gettext_lazy as _ 3 | 4 | from rest_framework import serializers 5 | 6 | 7 | class AuthTokenSerializer(serializers.Serializer): 8 | username = serializers.CharField(label=_("Username")) 9 | password = serializers.CharField( 10 | label=_("Password"), 11 | style={'input_type': 'password'}, 12 | trim_whitespace=False 13 | ) 14 | 15 | def validate(self, attrs): 16 | username = attrs.get('username') 17 | password = attrs.get('password') 18 | 19 | if username and password: 20 | user = authenticate(request=self.context.get('request'), 21 | username=username, password=password) 22 | 23 | # The authenticate call simply returns None for is_active=False 24 | # users. (Assuming the default ModelBackend authentication 25 | # backend.) 26 | if not user: 27 | msg = _('Unable to log in with provided credentials.') 28 | raise serializers.ValidationError(msg, code='authorization') 29 | else: 30 | msg = _('Must include "username" and "password".') 31 | raise serializers.ValidationError(msg, code='authorization') 32 | 33 | attrs['user'] = user 34 | return attrs 35 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/checkbox_multiple.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 8 | {% endif %} 9 | 10 |
11 | {% if style.inline %} 12 | {% for key, text in field.choices|items %} 13 | 17 | {% endfor %} 18 | {% else %} 19 | {% for key, text in field.choices|items %} 20 |
21 | 25 |
26 | {% endfor %} 27 | {% endif %} 28 | 29 | {% if field.errors %} 30 | {% for error in field.errors %} 31 | {{ error }} 32 | {% endfor %} 33 | {% endif %} 34 | 35 | {% if field.help_text %} 36 | {{ field.help_text|safe }} 37 | {% endif %} 38 |
39 |
40 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/select.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 |
4 | {% if field.label %} 5 | 8 | {% endif %} 9 | 10 |
11 | 25 | 26 | {% if field.errors %} 27 | {% for error in field.errors %} 28 | {{ error }} 29 | {% endfor %} 30 | {% endif %} 31 | 32 | {% if field.help_text %} 33 | {{ field.help_text|safe }} 34 | {% endif %} 35 |
36 |
37 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/pagination/numbers.html: -------------------------------------------------------------------------------- 1 |
    2 | {% if previous_url %} 3 |
  • 4 | 5 | 6 | 7 |
  • 8 | {% else %} 9 |
  • 10 | 11 | 12 | 13 |
  • 14 | {% endif %} 15 | 16 | {% for page_link in page_links %} 17 | {% if page_link.is_break %} 18 |
  • 19 | 20 |
  • 21 | {% else %} 22 | {% if page_link.is_active %} 23 |
  • 24 | {{ page_link.number }} 25 |
  • 26 | {% else %} 27 |
  • 28 | {{ page_link.number }} 29 |
  • 30 | {% endif %} 31 | {% endif %} 32 | {% endfor %} 33 | 34 | {% if next_url %} 35 |
  • 36 | 37 | 38 | 39 |
  • 40 | {% else %} 41 |
  • 42 | 43 | 44 | 45 |
  • 46 | {% endif %} 47 |
48 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/select_multiple.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load rest_framework %} 3 | 4 | {% trans "No items to select." as no_items %} 5 | 6 |
7 | {% if field.label %} 8 | 11 | {% endif %} 12 | 13 |
14 | 27 | 28 | {% if field.errors %} 29 | {% for error in field.errors %} 30 | {{ error }} 31 | {% endfor %} 32 | {% endif %} 33 | 34 | {% if field.help_text %} 35 | {{ field.help_text|safe }} 36 | {% endif %} 37 |
38 |
39 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/auth/basic.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | 39 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/js/default.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | // JSON highlighting. 3 | prettyPrint(); 4 | 5 | // Bootstrap tooltips. 6 | $('.js-tooltip').tooltip({ 7 | delay: 1000, 8 | container: 'body' 9 | }); 10 | 11 | // Deal with rounded tab styling after tab clicks. 12 | $('a[data-toggle="tab"]:first').on('shown', function(e) { 13 | $(e.target).parents('.tabbable').addClass('first-tab-active'); 14 | }); 15 | 16 | $('a[data-toggle="tab"]:not(:first)').on('shown', function(e) { 17 | $(e.target).parents('.tabbable').removeClass('first-tab-active'); 18 | }); 19 | 20 | $('a[data-toggle="tab"]').click(function() { 21 | document.cookie = "tabstyle=" + this.name + "; path=/"; 22 | }); 23 | 24 | // Store tab preference in cookies & display appropriate tab on load. 25 | var selectedTab = null; 26 | var selectedTabName = getCookie('tabstyle'); 27 | 28 | if (selectedTabName) { 29 | selectedTabName = selectedTabName.replace(/[^a-z-]/g, ''); 30 | } 31 | 32 | if (selectedTabName) { 33 | selectedTab = $('.form-switcher a[name=' + selectedTabName + ']'); 34 | } 35 | 36 | if (selectedTab && selectedTab.length > 0) { 37 | // Display whichever tab is selected. 38 | selectedTab.tab('show'); 39 | } else { 40 | // If no tab selected, display rightmost tab. 41 | $('.form-switcher a:first').tab('show'); 42 | } 43 | 44 | $(window).on('load', function() { 45 | $('#errorModal').modal('show'); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/humanize_datetime.py: -------------------------------------------------------------------------------- 1 | """ 2 | Helper functions that convert strftime formats into more readable representations. 3 | """ 4 | from rest_framework import ISO_8601 5 | 6 | 7 | def datetime_formats(formats): 8 | format = ', '.join(formats).replace( 9 | ISO_8601, 10 | 'YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]' 11 | ) 12 | return humanize_strptime(format) 13 | 14 | 15 | def date_formats(formats): 16 | format = ', '.join(formats).replace(ISO_8601, 'YYYY-MM-DD') 17 | return humanize_strptime(format) 18 | 19 | 20 | def time_formats(formats): 21 | format = ', '.join(formats).replace(ISO_8601, 'hh:mm[:ss[.uuuuuu]]') 22 | return humanize_strptime(format) 23 | 24 | 25 | def humanize_strptime(format_string): 26 | # Note that we're missing some of the locale specific mappings that 27 | # don't really make sense. 28 | mapping = { 29 | "%Y": "YYYY", 30 | "%y": "YY", 31 | "%m": "MM", 32 | "%b": "[Jan-Dec]", 33 | "%B": "[January-December]", 34 | "%d": "DD", 35 | "%H": "hh", 36 | "%I": "hh", # Requires '%p' to differentiate from '%H'. 37 | "%M": "mm", 38 | "%S": "ss", 39 | "%f": "uuuuuu", 40 | "%a": "[Mon-Sun]", 41 | "%A": "[Monday-Sunday]", 42 | "%p": "[AM|PM]", 43 | "%z": "[+HHMM|-HHMM]" 44 | } 45 | for key, val in mapping.items(): 46 | format_string = format_string.replace(key, val) 47 | return format_string 48 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/css/default.css: -------------------------------------------------------------------------------- 1 | /* The navbar is fixed at >= 980px wide, so add padding to the body to prevent 2 | content running up underneath it. */ 3 | 4 | h1 { 5 | font-weight: 300; 6 | } 7 | 8 | h2, h3 { 9 | font-weight: 300; 10 | } 11 | 12 | .resource-description, .response-info { 13 | margin-bottom: 2em; 14 | } 15 | 16 | .version:before { 17 | content: "v"; 18 | opacity: 0.6; 19 | padding-right: 0.25em; 20 | } 21 | 22 | .version { 23 | font-size: 70%; 24 | } 25 | 26 | .format-option { 27 | font-family: Menlo, Consolas, "Andale Mono", "Lucida Console", monospace; 28 | } 29 | 30 | .button-form { 31 | float: right; 32 | margin-right: 1em; 33 | } 34 | 35 | td.nested { 36 | padding: 0 !important; 37 | } 38 | 39 | td.nested > table { 40 | margin: 0; 41 | } 42 | 43 | form select, form input, form textarea { 44 | width: 90%; 45 | } 46 | 47 | form select[multiple] { 48 | height: 150px; 49 | } 50 | 51 | /* To allow tooltips to work on disabled elements */ 52 | .disabled-tooltip-shield { 53 | position: absolute; 54 | top: 0; 55 | right: 0; 56 | bottom: 0; 57 | left: 0; 58 | } 59 | 60 | .errorlist { 61 | margin-top: 0.5em; 62 | } 63 | 64 | pre { 65 | overflow: auto; 66 | word-wrap: normal; 67 | white-space: pre; 68 | font-size: 12px; 69 | } 70 | 71 | .page-header { 72 | border-bottom: none; 73 | padding-bottom: 0px; 74 | } 75 | 76 | #filtersModal form input[type=submit] { 77 | width: auto; 78 | } 79 | 80 | #filtersModal .modal-body h2 { 81 | margin-top: 0 82 | } 83 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/management/commands/drf_create_token.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import get_user_model 2 | from django.core.management.base import BaseCommand, CommandError 3 | 4 | from rest_framework.authtoken.models import Token 5 | 6 | UserModel = get_user_model() 7 | 8 | 9 | class Command(BaseCommand): 10 | help = 'Create DRF Token for a given user' 11 | 12 | def create_user_token(self, username, reset_token): 13 | user = UserModel._default_manager.get_by_natural_key(username) 14 | 15 | if reset_token: 16 | Token.objects.filter(user=user).delete() 17 | 18 | token = Token.objects.get_or_create(user=user) 19 | return token[0] 20 | 21 | def add_arguments(self, parser): 22 | parser.add_argument('username', type=str) 23 | 24 | parser.add_argument( 25 | '-r', 26 | '--reset', 27 | action='store_true', 28 | dest='reset_token', 29 | default=False, 30 | help='Reset existing User token and create a new one', 31 | ) 32 | 33 | def handle(self, *args, **options): 34 | username = options['username'] 35 | reset_token = options['reset_token'] 36 | 37 | try: 38 | token = self.create_user_token(username, reset_token) 39 | except UserModel.DoesNotExist: 40 | raise CommandError( 41 | 'Cannot create the Token: user {} does not exist'.format( 42 | username) 43 | ) 44 | self.stdout.write( 45 | 'Generated token {} for user {}'.format(token.key, username)) 46 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/djangorestframework-3.11.0.dist-info/LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | Copyright © 2011-present, [Encode OSS Ltd](https://www.encode.io/). 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/auth/token.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | 37 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/js/csrf.js: -------------------------------------------------------------------------------- 1 | function getCookie(name) { 2 | var cookieValue = null; 3 | 4 | if (document.cookie && document.cookie != '') { 5 | var cookies = document.cookie.split(';'); 6 | 7 | for (var i = 0; i < cookies.length; i++) { 8 | var cookie = jQuery.trim(cookies[i]); 9 | 10 | // Does this cookie string begin with the name we want? 11 | if (cookie.substring(0, name.length + 1) == (name + '=')) { 12 | cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 13 | break; 14 | } 15 | } 16 | } 17 | 18 | return cookieValue; 19 | } 20 | 21 | function csrfSafeMethod(method) { 22 | // these HTTP methods do not require CSRF protection 23 | return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); 24 | } 25 | 26 | function sameOrigin(url) { 27 | // test that a given url is a same-origin URL 28 | // url could be relative or scheme relative or absolute 29 | var host = document.location.host; // host + port 30 | var protocol = document.location.protocol; 31 | var sr_origin = '//' + host; 32 | var origin = protocol + sr_origin; 33 | 34 | // Allow absolute or scheme relative URLs to same origin 35 | return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || 36 | (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || 37 | // or any other URL that isn't scheme relative or absolute i.e relative. 38 | !(/^(\/\/|http:|https:).*/.test(url)); 39 | } 40 | 41 | var csrftoken = window.drf.csrfToken; 42 | 43 | $.ajaxSetup({ 44 | beforeSend: function(xhr, settings) { 45 | if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) { 46 | // Send the token to same-origin, relative URLs only. 47 | // Send the token only if the method warrants CSRF protection 48 | // Using the CSRFToken value acquired earlier 49 | xhr.setRequestHeader(window.drf.csrfHeaderName, csrftoken); 50 | } 51 | } 52 | }); 53 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/schemas/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | rest_framework.schemas 3 | 4 | schemas: 5 | __init__.py 6 | generators.py # Top-down schema generation 7 | inspectors.py # Per-endpoint view introspection 8 | utils.py # Shared helper functions 9 | views.py # Houses `SchemaView`, `APIView` subclass. 10 | 11 | We expose a minimal "public" API directly from `schemas`. This covers the 12 | basic use-cases: 13 | 14 | from rest_framework.schemas import ( 15 | AutoSchema, 16 | ManualSchema, 17 | get_schema_view, 18 | SchemaGenerator, 19 | ) 20 | 21 | Other access should target the submodules directly 22 | """ 23 | from rest_framework.settings import api_settings 24 | 25 | from . import coreapi, openapi 26 | from .coreapi import AutoSchema, ManualSchema, SchemaGenerator # noqa 27 | from .inspectors import DefaultSchema # noqa 28 | 29 | 30 | def get_schema_view( 31 | title=None, url=None, description=None, urlconf=None, renderer_classes=None, 32 | public=False, patterns=None, generator_class=None, 33 | authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, 34 | permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES, 35 | version=None): 36 | """ 37 | Return a schema view. 38 | """ 39 | if generator_class is None: 40 | if coreapi.is_enabled(): 41 | generator_class = coreapi.SchemaGenerator 42 | else: 43 | generator_class = openapi.SchemaGenerator 44 | 45 | generator = generator_class( 46 | title=title, url=url, description=description, 47 | urlconf=urlconf, patterns=patterns, version=version 48 | ) 49 | 50 | # Avoid import cycle on APIView 51 | from .views import SchemaView 52 | return SchemaView.as_view( 53 | renderer_classes=renderer_classes, 54 | schema_generator=generator, 55 | public=public, 56 | authentication_classes=authentication_classes, 57 | permission_classes=permission_classes, 58 | ) 59 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/schemas/views.py: -------------------------------------------------------------------------------- 1 | """ 2 | views.py # Houses `SchemaView`, `APIView` subclass. 3 | 4 | See schemas.__init__.py for package overview. 5 | """ 6 | from rest_framework import exceptions, renderers 7 | from rest_framework.response import Response 8 | from rest_framework.schemas import coreapi 9 | from rest_framework.settings import api_settings 10 | from rest_framework.views import APIView 11 | 12 | 13 | class SchemaView(APIView): 14 | _ignore_model_permissions = True 15 | schema = None # exclude from schema 16 | renderer_classes = None 17 | schema_generator = None 18 | public = False 19 | 20 | def __init__(self, *args, **kwargs): 21 | super().__init__(*args, **kwargs) 22 | if self.renderer_classes is None: 23 | if coreapi.is_enabled(): 24 | self.renderer_classes = [ 25 | renderers.CoreAPIOpenAPIRenderer, 26 | renderers.CoreJSONRenderer 27 | ] 28 | else: 29 | self.renderer_classes = [ 30 | renderers.OpenAPIRenderer, 31 | renderers.JSONOpenAPIRenderer, 32 | ] 33 | if renderers.BrowsableAPIRenderer in api_settings.DEFAULT_RENDERER_CLASSES: 34 | self.renderer_classes += [renderers.BrowsableAPIRenderer] 35 | 36 | def get(self, request, *args, **kwargs): 37 | schema = self.schema_generator.get_schema(request, self.public) 38 | if schema is None: 39 | raise exceptions.PermissionDenied() 40 | return Response(schema) 41 | 42 | def handle_exception(self, exc): 43 | # Schema renderers do not render exceptions, so re-perform content 44 | # negotiation with default renderers. 45 | self.renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES 46 | neg = self.perform_content_negotiation(self.request, force=True) 47 | self.request.accepted_renderer, self.request.accepted_media_type = neg 48 | return super().handle_exception(exc) 49 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/interact.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 3 | 4 | 52 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/horizontal/radio.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load rest_framework %} 3 | 4 | {% trans "None" as none_choice %} 5 | 6 |
7 | {% if field.label %} 8 | 11 | {% endif %} 12 | 13 |
14 | {% if style.inline %} 15 | {% if field.allow_null or field.allow_blank %} 16 | 20 | {% endif %} 21 | 22 | {% for key, text in field.choices|items %} 23 | 27 | {% endfor %} 28 | {% else %} 29 | {% if field.allow_null or field.allow_blank %} 30 |
31 | 35 |
36 | {% endif %} 37 | {% for key, text in field.choices|items %} 38 |
39 | 43 |
44 | {% endfor %} 45 | {% endif %} 46 | 47 | {% if field.errors %} 48 | {% for error in field.errors %} 49 | {{ error }} 50 | {% endfor %} 51 | {% endif %} 52 | 53 | {% if field.help_text %} 54 | {{ field.help_text|safe }} 55 | {% endif %} 56 |
57 |
58 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/vertical/radio.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load rest_framework %} 3 | {% trans "None" as none_choice %} 4 | 5 |
6 | {% if field.label %} 7 | 10 | {% endif %} 11 | 12 | {% if style.inline %} 13 |
14 | {% if field.allow_null or field.allow_blank %} 15 | 19 | {% endif %} 20 | 21 | {% for key, text in field.choices|items %} 22 | 26 | {% endfor %} 27 |
28 | {% else %} 29 | {% if field.allow_null or field.allow_blank %} 30 |
31 | 35 |
36 | {% endif %} 37 | 38 | {% for key, text in field.choices|items %} 39 |
40 | 44 |
45 | {% endfor %} 46 | {% endif %} 47 | 48 | {% if field.errors %} 49 | {% for error in field.errors %} 50 | {{ error }} 51 | {% endfor %} 52 | {% endif %} 53 | 54 | {% if field.help_text %} 55 | {{ field.help_text|safe }} 56 | {% endif %} 57 |
58 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/authtoken/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework import parsers, renderers 2 | from rest_framework.authtoken.models import Token 3 | from rest_framework.authtoken.serializers import AuthTokenSerializer 4 | from rest_framework.compat import coreapi, coreschema 5 | from rest_framework.response import Response 6 | from rest_framework.schemas import ManualSchema 7 | from rest_framework.views import APIView 8 | 9 | 10 | class ObtainAuthToken(APIView): 11 | throttle_classes = () 12 | permission_classes = () 13 | parser_classes = (parsers.FormParser, parsers.MultiPartParser, parsers.JSONParser,) 14 | renderer_classes = (renderers.JSONRenderer,) 15 | serializer_class = AuthTokenSerializer 16 | if coreapi is not None and coreschema is not None: 17 | schema = ManualSchema( 18 | fields=[ 19 | coreapi.Field( 20 | name="username", 21 | required=True, 22 | location='form', 23 | schema=coreschema.String( 24 | title="Username", 25 | description="Valid username for authentication", 26 | ), 27 | ), 28 | coreapi.Field( 29 | name="password", 30 | required=True, 31 | location='form', 32 | schema=coreschema.String( 33 | title="Password", 34 | description="Valid password for authentication", 35 | ), 36 | ), 37 | ], 38 | encoding="application/json", 39 | ) 40 | 41 | def post(self, request, *args, **kwargs): 42 | serializer = self.serializer_class(data=request.data, 43 | context={'request': request}) 44 | serializer.is_valid(raise_exception=True) 45 | user = serializer.validated_data['user'] 46 | token, created = Token.objects.get_or_create(user=user) 47 | return Response({'token': token.key}) 48 | 49 | 50 | obtain_auth_token = ObtainAuthToken.as_view() 51 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/error.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Error Rendering Schema 10 | 11 | 12 | 13 | 14 | 15 |

Error

16 | 17 |
18 | {{ data }}
19 | 
20 | 21 | 22 | {% if debug is True %} 23 |
24 |

Additional Information

25 |

Note: You are seeing this message because DEBUG==True.

26 | 27 |

Seeing this page is usually a configuration error: are your 28 | DEFAULT_AUTHENTICATION_CLASSES or DEFAULT_PERMISSION_CLASSES 29 | being applied unexpectedly?

30 | 31 |

Your response status code is: {{ response.status_code }}

32 | 33 |

401 Unauthorised.

34 |
    35 |
  • Do you have SessionAuthentication enabled?
  • 36 |
  • Are you logged in?
  • 37 |
38 | 39 | 40 |

403 Forbidden.

41 |
    42 |
  • Do you have sufficient permissions to access this view?
  • 43 |
  • Is you schema non-empty? (An empty schema will lead to a permission denied error being raised.)
  • 44 |
45 | 46 | 47 |

Most commonly the intended solution is to disable authentication and permissions 48 | when including the docs urls:

49 | 50 |
51 |    url(r'^docs/', include_docs_urls(title='Your API',
52 |                                     authentication_classes=[],
53 |                                     permission_classes=[])),
54 | 
55 | 56 | 57 |

Overriding this template

58 | 59 |

If you wish access to your docs to be authenticated you may override this template 60 | at rest_framework/docs/error.html.

61 | 62 |

The available context is: data the error dict above, request, 63 | response and the debug flag.

64 | 65 | {% endif %} 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /CRUDapp/views.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse 2 | from django.shortcuts import render 3 | 4 | from .serializers import StudentSerializer 5 | from .form import StudentForm 6 | from .models import Student 7 | from django.views import View 8 | 9 | 10 | class CRUDOps(View): 11 | # def getmodal(self): #never used - just for future reference 12 | # data = Student.objects.all() 13 | # modal = "" 14 | # for entry in data: 15 | # modal += " " + entry.eno + "" + entry.name + "" + entry.branch + "" 16 | # modal += "" 17 | # modal += "" 18 | # modal += "" 19 | 20 | # return modal 21 | 22 | def get(self, request): 23 | form = StudentForm(request.POST) 24 | 25 | studentdata = Student.objects.all() 26 | 27 | context = {'form': form, 'studentdata': studentdata} 28 | return render(request, 'index.html', context) 29 | # return JsonResponse(context) 30 | 31 | def post(self, request, sid=None): 32 | form = StudentForm(request.POST) 33 | 34 | if sid is not None: 35 | student = Student.objects.get(id=sid) 36 | form = StudentForm(request.POST, instance=student) 37 | 38 | if form.is_valid(): 39 | form.save() 40 | 41 | studentdata = Student.objects.all() 42 | 43 | context = {'form': form, 'studentdata': studentdata} 44 | return render(request, 'index.html', context) 45 | 46 | def put(self, request, sid): 47 | 48 | if sid is not None: 49 | studentdata = Student.objects.get(id=sid) 50 | 51 | return JsonResponse(StudentSerializer(studentdata).data, safe=False) 52 | 53 | def delete(self, request, sid): 54 | form = StudentForm(request.POST) 55 | student = Student.objects.get(id=sid) 56 | student.delete() 57 | studentdata = Student.objects.all() 58 | context = {'form': form, 'studentdata': studentdata} 59 | return render(request, 'index.html', context) 60 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/breadcrumbs.py: -------------------------------------------------------------------------------- 1 | from django.urls import get_script_prefix, resolve 2 | 3 | 4 | def get_breadcrumbs(url, request=None): 5 | """ 6 | Given a url returns a list of breadcrumbs, which are each a 7 | tuple of (name, url). 8 | """ 9 | from rest_framework.reverse import preserve_builtin_query_params 10 | from rest_framework.views import APIView 11 | 12 | def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen): 13 | """ 14 | Add tuples of (name, url) to the breadcrumbs list, 15 | progressively chomping off parts of the url. 16 | """ 17 | try: 18 | (view, unused_args, unused_kwargs) = resolve(url) 19 | except Exception: 20 | pass 21 | else: 22 | # Check if this is a REST framework view, 23 | # and if so add it to the breadcrumbs 24 | cls = getattr(view, 'cls', None) 25 | initkwargs = getattr(view, 'initkwargs', {}) 26 | if cls is not None and issubclass(cls, APIView): 27 | # Don't list the same view twice in a row. 28 | # Probably an optional trailing slash. 29 | if not seen or seen[-1] != view: 30 | c = cls(**initkwargs) 31 | name = c.get_view_name() 32 | insert_url = preserve_builtin_query_params(prefix + url, request) 33 | breadcrumbs_list.insert(0, (name, insert_url)) 34 | seen.append(view) 35 | 36 | if url == '': 37 | # All done 38 | return breadcrumbs_list 39 | 40 | elif url.endswith('/'): 41 | # Drop trailing slash off the end and continue to try to 42 | # resolve more breadcrumbs 43 | url = url.rstrip('/') 44 | return breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen) 45 | 46 | # Drop trailing non-slash off the end and continue to try to 47 | # resolve more breadcrumbs 48 | url = url[:url.rfind('/') + 1] 49 | return breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen) 50 | 51 | prefix = get_script_prefix().rstrip('/') 52 | url = url[len(prefix):] 53 | return breadcrumbs_recursive(url, [], prefix, []) 54 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* 2 | This is the GitHub theme for highlight.js 3 | 4 | github.com style (c) Vasily Polovnyov 5 | 6 | */ 7 | 8 | .hljs { 9 | display: block; 10 | overflow-x: auto; 11 | padding: 0.5em; 12 | color: #333; 13 | -webkit-text-size-adjust: none; 14 | } 15 | 16 | .hljs-comment, 17 | .diff .hljs-header, 18 | .hljs-javadoc { 19 | color: #998; 20 | font-style: italic; 21 | } 22 | 23 | .hljs-keyword, 24 | .css .rule .hljs-keyword, 25 | .hljs-winutils, 26 | .nginx .hljs-title, 27 | .hljs-subst, 28 | .hljs-request, 29 | .hljs-status { 30 | color: #333; 31 | font-weight: bold; 32 | } 33 | 34 | .hljs-number, 35 | .hljs-hexcolor, 36 | .ruby .hljs-constant { 37 | color: #008080; 38 | } 39 | 40 | .hljs-string, 41 | .hljs-tag .hljs-value, 42 | .hljs-phpdoc, 43 | .hljs-dartdoc, 44 | .tex .hljs-formula { 45 | color: #d14; 46 | } 47 | 48 | .hljs-title, 49 | .hljs-id, 50 | .scss .hljs-preprocessor { 51 | color: #900; 52 | font-weight: bold; 53 | } 54 | 55 | .hljs-list .hljs-keyword, 56 | .hljs-subst { 57 | font-weight: normal; 58 | } 59 | 60 | .hljs-class .hljs-title, 61 | .hljs-type, 62 | .vhdl .hljs-literal, 63 | .tex .hljs-command { 64 | color: #458; 65 | font-weight: bold; 66 | } 67 | 68 | .hljs-tag, 69 | .hljs-tag .hljs-title, 70 | .hljs-rule .hljs-property, 71 | .django .hljs-tag .hljs-keyword { 72 | color: #000080; 73 | font-weight: normal; 74 | } 75 | 76 | .hljs-attribute, 77 | .hljs-variable, 78 | .lisp .hljs-body, 79 | .hljs-name { 80 | color: #008080; 81 | } 82 | 83 | .hljs-regexp { 84 | color: #009926; 85 | } 86 | 87 | .hljs-symbol, 88 | .ruby .hljs-symbol .hljs-string, 89 | .lisp .hljs-keyword, 90 | .clojure .hljs-keyword, 91 | .scheme .hljs-keyword, 92 | .tex .hljs-special, 93 | .hljs-prompt { 94 | color: #990073; 95 | } 96 | 97 | .hljs-built_in { 98 | color: #0086b3; 99 | } 100 | 101 | .hljs-preprocessor, 102 | .hljs-pragma, 103 | .hljs-pi, 104 | .hljs-doctype, 105 | .hljs-shebang, 106 | .hljs-cdata { 107 | color: #999; 108 | font-weight: bold; 109 | } 110 | 111 | .hljs-deletion { 112 | background: #fdd; 113 | } 114 | 115 | .hljs-addition { 116 | background: #dfd; 117 | } 118 | 119 | .diff .hljs-change { 120 | background: #0086b3; 121 | } 122 | 123 | .hljs-chunk { 124 | color: #aaa; 125 | } 126 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/reverse.py: -------------------------------------------------------------------------------- 1 | """ 2 | Provide urlresolver functions that return fully qualified URLs or view names 3 | """ 4 | from django.urls import NoReverseMatch 5 | from django.urls import reverse as django_reverse 6 | from django.utils.functional import lazy 7 | 8 | from rest_framework.settings import api_settings 9 | from rest_framework.utils.urls import replace_query_param 10 | 11 | 12 | def preserve_builtin_query_params(url, request=None): 13 | """ 14 | Given an incoming request, and an outgoing URL representation, 15 | append the value of any built-in query parameters. 16 | """ 17 | if request is None: 18 | return url 19 | 20 | overrides = [ 21 | api_settings.URL_FORMAT_OVERRIDE, 22 | ] 23 | 24 | for param in overrides: 25 | if param and (param in request.GET): 26 | value = request.GET[param] 27 | url = replace_query_param(url, param, value) 28 | 29 | return url 30 | 31 | 32 | def reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra): 33 | """ 34 | If versioning is being used then we pass any `reverse` calls through 35 | to the versioning scheme instance, so that the resulting URL 36 | can be modified if needed. 37 | """ 38 | scheme = getattr(request, 'versioning_scheme', None) 39 | if scheme is not None: 40 | try: 41 | url = scheme.reverse(viewname, args, kwargs, request, format, **extra) 42 | except NoReverseMatch: 43 | # In case the versioning scheme reversal fails, fallback to the 44 | # default implementation 45 | url = _reverse(viewname, args, kwargs, request, format, **extra) 46 | else: 47 | url = _reverse(viewname, args, kwargs, request, format, **extra) 48 | 49 | return preserve_builtin_query_params(url, request) 50 | 51 | 52 | def _reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra): 53 | """ 54 | Same as `django.urls.reverse`, but optionally takes a request 55 | and returns a fully qualified URL, using the request to get the base URL. 56 | """ 57 | if format is not None: 58 | kwargs = kwargs or {} 59 | kwargs['format'] = format 60 | url = django_reverse(viewname, args=args, kwargs=kwargs, **extra) 61 | if request: 62 | return request.build_absolute_uri(url) 63 | return url 64 | 65 | 66 | reverse_lazy = lazy(reverse, str) 67 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/docs/js/jquery.json-view.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jquery.json-view - jQuery collapsible JSON plugin 3 | * @version v1.0.0 4 | * @link http://github.com/bazh/jquery.json-view 5 | * @license MIT 6 | */ 7 | !function(e){"use strict";var n=function(n){var a=e("",{"class":"collapser",on:{click:function(){var n=e(this);n.toggleClass("collapsed");var a=n.parent().children(".block"),p=a.children("ul");n.hasClass("collapsed")?(p.hide(),a.children(".dots, .comments").show()):(p.show(),a.children(".dots, .comments").hide())}}});return n&&a.addClass("collapsed"),a},a=function(a,p){var t=e.extend({},{nl2br:!0},p),r=function(e){return e.toString()?e.toString().replace(/&/g,"&").replace(/"/g,""").replace(//g,">"):""},s=function(n,a){return e("",{"class":a,html:r(n)})},l=function(a,p){switch(e.type(a)){case"object":p||(p=0);var c=e("",{"class":"block"}),d=Object.keys(a).length;if(!d)return c.append(s("{","b")).append(" ").append(s("}","b"));c.append(s("{","b"));var i=e("
    ",{"class":"obj collapsible level"+p});return e.each(a,function(a,t){d--;var r=e("
  • ").append(s('"',"q")).append(a).append(s('"',"q")).append(": ").append(l(t,p+1));-1===["object","array"].indexOf(e.type(t))||e.isEmptyObject(t)||r.prepend(n()),d>0&&r.append(","),i.append(r)}),c.append(i),c.append(s("...","dots")),c.append(s("}","b")),c.append(1===Object.keys(a).length?s("// 1 item","comments"):s("// "+Object.keys(a).length+" items","comments")),c;case"array":p||(p=0);var d=a.length,c=e("",{"class":"block"});if(!d)return c.append(s("[","b")).append(" ").append(s("]","b"));c.append(s("[","b"));var i=e("
      ",{"class":"obj collapsible level"+p});return e.each(a,function(a,t){d--;var r=e("
    • ").append(l(t,p+1));-1===["object","array"].indexOf(e.type(t))||e.isEmptyObject(t)||r.prepend(n()),d>0&&r.append(","),i.append(r)}),c.append(i),c.append(s("...","dots")),c.append(s("]","b")),c.append(1===a.length?s("// 1 item","comments"):s("// "+a.length+" items","comments")),c;case"string":if(a=r(a),/^(http|https|file):\/\/[^\s]+$/i.test(a))return e("").append(s('"',"q")).append(e("",{href:a,text:a})).append(s('"',"q"));if(t.nl2br){var o=/\n/g;o.test(a)&&(a=(a+"").replace(o,"
      "))}var u=e("",{"class":"str"}).html(a);return e("").append(s('"',"q")).append(u).append(s('"',"q"));case"number":return s(a.toString(),"num");case"undefined":return s("undefined","undef");case"null":return s("null","null");case"boolean":return s(a?"true":"false","bool")}};return l(a)};return e.fn.jsonView=function(n,p){var t=e(this);if(p=e.extend({},{nl2br:!0},p),"string"==typeof n)try{n=JSON.parse(n)}catch(r){}return t.append(e("
      ",{"class":"json-view"}).append(a(n,p))),t}}(jQuery); -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/html.py: -------------------------------------------------------------------------------- 1 | """ 2 | Helpers for dealing with HTML input. 3 | """ 4 | import re 5 | 6 | from django.utils.datastructures import MultiValueDict 7 | 8 | 9 | def is_html_input(dictionary): 10 | # MultiDict type datastructures are used to represent HTML form input, 11 | # which may have more than one value for each key. 12 | return hasattr(dictionary, 'getlist') 13 | 14 | 15 | def parse_html_list(dictionary, prefix='', default=None): 16 | """ 17 | Used to support list values in HTML forms. 18 | Supports lists of primitives and/or dictionaries. 19 | 20 | * List of primitives. 21 | 22 | { 23 | '[0]': 'abc', 24 | '[1]': 'def', 25 | '[2]': 'hij' 26 | } 27 | --> 28 | [ 29 | 'abc', 30 | 'def', 31 | 'hij' 32 | ] 33 | 34 | * List of dictionaries. 35 | 36 | { 37 | '[0]foo': 'abc', 38 | '[0]bar': 'def', 39 | '[1]foo': 'hij', 40 | '[1]bar': 'klm', 41 | } 42 | --> 43 | [ 44 | {'foo': 'abc', 'bar': 'def'}, 45 | {'foo': 'hij', 'bar': 'klm'} 46 | ] 47 | 48 | :returns a list of objects, or the value specified in ``default`` if the list is empty 49 | """ 50 | ret = {} 51 | regex = re.compile(r'^%s\[([0-9]+)\](.*)$' % re.escape(prefix)) 52 | for field, value in dictionary.items(): 53 | match = regex.match(field) 54 | if not match: 55 | continue 56 | index, key = match.groups() 57 | index = int(index) 58 | if not key: 59 | ret[index] = value 60 | elif isinstance(ret.get(index), dict): 61 | ret[index][key] = value 62 | else: 63 | ret[index] = MultiValueDict({key: [value]}) 64 | 65 | # return the items of the ``ret`` dict, sorted by key, or ``default`` if the dict is empty 66 | return [ret[item] for item in sorted(ret)] if ret else default 67 | 68 | 69 | def parse_html_dict(dictionary, prefix=''): 70 | """ 71 | Used to support dictionary values in HTML forms. 72 | 73 | { 74 | 'profile.username': 'example', 75 | 'profile.email': 'example@example.com', 76 | } 77 | --> 78 | { 79 | 'profile': { 80 | 'username': 'example', 81 | 'email': 'example@example.com' 82 | } 83 | } 84 | """ 85 | ret = MultiValueDict() 86 | regex = re.compile(r'^%s\.(.+)$' % re.escape(prefix)) 87 | for field in dictionary: 88 | match = regex.match(field) 89 | if not match: 90 | continue 91 | key = match.groups()[0] 92 | value = dictionary.getlist(field) 93 | ret.setlist(key, value) 94 | 95 | return ret 96 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/index.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ document.title }} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% if code_style %}{% endif %} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | {% include "rest_framework/docs/sidebar.html" %} 28 | 29 |
      30 |
      31 |
      32 | {% include "rest_framework/docs/document.html" %} 33 |
      34 |
      35 |
      36 | 37 | {% include "rest_framework/docs/auth/token.html" %} 38 | {% include "rest_framework/docs/auth/basic.html" %} 39 | {% include "rest_framework/docs/auth/session.html" %} 40 | 41 | 42 | 43 | 44 | 45 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/sidebar.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 |
      45 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/encoders.py: -------------------------------------------------------------------------------- 1 | """ 2 | Helper classes for parsers. 3 | """ 4 | import datetime 5 | import decimal 6 | import json # noqa 7 | import uuid 8 | 9 | from django.db.models.query import QuerySet 10 | from django.utils import timezone 11 | from django.utils.encoding import force_str 12 | from django.utils.functional import Promise 13 | 14 | from rest_framework.compat import coreapi 15 | 16 | 17 | class JSONEncoder(json.JSONEncoder): 18 | """ 19 | JSONEncoder subclass that knows how to encode date/time/timedelta, 20 | decimal types, generators and other basic python objects. 21 | """ 22 | def default(self, obj): 23 | # For Date Time string spec, see ECMA 262 24 | # https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 25 | if isinstance(obj, Promise): 26 | return force_str(obj) 27 | elif isinstance(obj, datetime.datetime): 28 | representation = obj.isoformat() 29 | if representation.endswith('+00:00'): 30 | representation = representation[:-6] + 'Z' 31 | return representation 32 | elif isinstance(obj, datetime.date): 33 | return obj.isoformat() 34 | elif isinstance(obj, datetime.time): 35 | if timezone and timezone.is_aware(obj): 36 | raise ValueError("JSON can't represent timezone-aware times.") 37 | representation = obj.isoformat() 38 | return representation 39 | elif isinstance(obj, datetime.timedelta): 40 | return str(obj.total_seconds()) 41 | elif isinstance(obj, decimal.Decimal): 42 | # Serializers will coerce decimals to strings by default. 43 | return float(obj) 44 | elif isinstance(obj, uuid.UUID): 45 | return str(obj) 46 | elif isinstance(obj, QuerySet): 47 | return tuple(obj) 48 | elif isinstance(obj, bytes): 49 | # Best-effort for binary blobs. See #4187. 50 | return obj.decode() 51 | elif hasattr(obj, 'tolist'): 52 | # Numpy arrays and array scalars. 53 | return obj.tolist() 54 | elif (coreapi is not None) and isinstance(obj, (coreapi.Document, coreapi.Error)): 55 | raise RuntimeError( 56 | 'Cannot return a coreapi object from a JSON view. ' 57 | 'You should be using a schema renderer instead for this view.' 58 | ) 59 | elif hasattr(obj, '__getitem__'): 60 | cls = (list if isinstance(obj, (list, tuple)) else dict) 61 | try: 62 | return cls(obj) 63 | except Exception: 64 | pass 65 | elif hasattr(obj, '__iter__'): 66 | return tuple(item for item in obj) 67 | return super().default(obj) 68 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/status.py: -------------------------------------------------------------------------------- 1 | """ 2 | Descriptive HTTP status codes, for code readability. 3 | 4 | See RFC 2616 - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 5 | And RFC 6585 - https://tools.ietf.org/html/rfc6585 6 | And RFC 4918 - https://tools.ietf.org/html/rfc4918 7 | """ 8 | 9 | 10 | def is_informational(code): 11 | return 100 <= code <= 199 12 | 13 | 14 | def is_success(code): 15 | return 200 <= code <= 299 16 | 17 | 18 | def is_redirect(code): 19 | return 300 <= code <= 399 20 | 21 | 22 | def is_client_error(code): 23 | return 400 <= code <= 499 24 | 25 | 26 | def is_server_error(code): 27 | return 500 <= code <= 599 28 | 29 | 30 | HTTP_100_CONTINUE = 100 31 | HTTP_101_SWITCHING_PROTOCOLS = 101 32 | HTTP_200_OK = 200 33 | HTTP_201_CREATED = 201 34 | HTTP_202_ACCEPTED = 202 35 | HTTP_203_NON_AUTHORITATIVE_INFORMATION = 203 36 | HTTP_204_NO_CONTENT = 204 37 | HTTP_205_RESET_CONTENT = 205 38 | HTTP_206_PARTIAL_CONTENT = 206 39 | HTTP_207_MULTI_STATUS = 207 40 | HTTP_208_ALREADY_REPORTED = 208 41 | HTTP_226_IM_USED = 226 42 | HTTP_300_MULTIPLE_CHOICES = 300 43 | HTTP_301_MOVED_PERMANENTLY = 301 44 | HTTP_302_FOUND = 302 45 | HTTP_303_SEE_OTHER = 303 46 | HTTP_304_NOT_MODIFIED = 304 47 | HTTP_305_USE_PROXY = 305 48 | HTTP_306_RESERVED = 306 49 | HTTP_307_TEMPORARY_REDIRECT = 307 50 | HTTP_308_PERMANENT_REDIRECT = 308 51 | HTTP_400_BAD_REQUEST = 400 52 | HTTP_401_UNAUTHORIZED = 401 53 | HTTP_402_PAYMENT_REQUIRED = 402 54 | HTTP_403_FORBIDDEN = 403 55 | HTTP_404_NOT_FOUND = 404 56 | HTTP_405_METHOD_NOT_ALLOWED = 405 57 | HTTP_406_NOT_ACCEPTABLE = 406 58 | HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407 59 | HTTP_408_REQUEST_TIMEOUT = 408 60 | HTTP_409_CONFLICT = 409 61 | HTTP_410_GONE = 410 62 | HTTP_411_LENGTH_REQUIRED = 411 63 | HTTP_412_PRECONDITION_FAILED = 412 64 | HTTP_413_REQUEST_ENTITY_TOO_LARGE = 413 65 | HTTP_414_REQUEST_URI_TOO_LONG = 414 66 | HTTP_415_UNSUPPORTED_MEDIA_TYPE = 415 67 | HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = 416 68 | HTTP_417_EXPECTATION_FAILED = 417 69 | HTTP_418_IM_A_TEAPOT = 418 70 | HTTP_422_UNPROCESSABLE_ENTITY = 422 71 | HTTP_423_LOCKED = 423 72 | HTTP_424_FAILED_DEPENDENCY = 424 73 | HTTP_426_UPGRADE_REQUIRED = 426 74 | HTTP_428_PRECONDITION_REQUIRED = 428 75 | HTTP_429_TOO_MANY_REQUESTS = 429 76 | HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431 77 | HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS = 451 78 | HTTP_500_INTERNAL_SERVER_ERROR = 500 79 | HTTP_501_NOT_IMPLEMENTED = 501 80 | HTTP_502_BAD_GATEWAY = 502 81 | HTTP_503_SERVICE_UNAVAILABLE = 503 82 | HTTP_504_GATEWAY_TIMEOUT = 504 83 | HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505 84 | HTTP_506_VARIANT_ALSO_NEGOTIATES = 506 85 | HTTP_507_INSUFFICIENT_STORAGE = 507 86 | HTTP_508_LOOP_DETECTED = 508 87 | HTTP_509_BANDWIDTH_LIMIT_EXCEEDED = 509 88 | HTTP_510_NOT_EXTENDED = 510 89 | HTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511 90 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/management/commands/generateschema.py: -------------------------------------------------------------------------------- 1 | from django.core.management.base import BaseCommand 2 | from django.utils.module_loading import import_string 3 | 4 | from rest_framework import renderers 5 | from rest_framework.schemas import coreapi 6 | from rest_framework.schemas.openapi import SchemaGenerator 7 | 8 | OPENAPI_MODE = 'openapi' 9 | COREAPI_MODE = 'coreapi' 10 | 11 | 12 | class Command(BaseCommand): 13 | help = "Generates configured API schema for project." 14 | 15 | def get_mode(self): 16 | return COREAPI_MODE if coreapi.is_enabled() else OPENAPI_MODE 17 | 18 | def add_arguments(self, parser): 19 | parser.add_argument('--title', dest="title", default='', type=str) 20 | parser.add_argument('--url', dest="url", default=None, type=str) 21 | parser.add_argument('--description', dest="description", default=None, type=str) 22 | if self.get_mode() == COREAPI_MODE: 23 | parser.add_argument('--format', dest="format", choices=['openapi', 'openapi-json', 'corejson'], default='openapi', type=str) 24 | else: 25 | parser.add_argument('--format', dest="format", choices=['openapi', 'openapi-json'], default='openapi', type=str) 26 | parser.add_argument('--urlconf', dest="urlconf", default=None, type=str) 27 | parser.add_argument('--generator_class', dest="generator_class", default=None, type=str) 28 | 29 | def handle(self, *args, **options): 30 | if options['generator_class']: 31 | generator_class = import_string(options['generator_class']) 32 | else: 33 | generator_class = self.get_generator_class() 34 | generator = generator_class( 35 | url=options['url'], 36 | title=options['title'], 37 | description=options['description'], 38 | urlconf=options['urlconf'], 39 | ) 40 | schema = generator.get_schema(request=None, public=True) 41 | renderer = self.get_renderer(options['format']) 42 | output = renderer.render(schema, renderer_context={}) 43 | self.stdout.write(output.decode()) 44 | 45 | def get_renderer(self, format): 46 | if self.get_mode() == COREAPI_MODE: 47 | renderer_cls = { 48 | 'corejson': renderers.CoreJSONRenderer, 49 | 'openapi': renderers.CoreAPIOpenAPIRenderer, 50 | 'openapi-json': renderers.CoreAPIJSONOpenAPIRenderer, 51 | }[format] 52 | return renderer_cls() 53 | 54 | renderer_cls = { 55 | 'openapi': renderers.OpenAPIRenderer, 56 | 'openapi-json': renderers.JSONOpenAPIRenderer, 57 | }[format] 58 | return renderer_cls() 59 | 60 | def get_generator_class(self): 61 | if self.get_mode() == COREAPI_MODE: 62 | return coreapi.SchemaGenerator 63 | return SchemaGenerator 64 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/mediatypes.py: -------------------------------------------------------------------------------- 1 | """ 2 | Handling of media types, as found in HTTP Content-Type and Accept headers. 3 | 4 | See https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 5 | """ 6 | from django.http.multipartparser import parse_header 7 | 8 | from rest_framework import HTTP_HEADER_ENCODING 9 | 10 | 11 | def media_type_matches(lhs, rhs): 12 | """ 13 | Returns ``True`` if the media type in the first argument <= the 14 | media type in the second argument. The media types are strings 15 | as described by the HTTP spec. 16 | 17 | Valid media type strings include: 18 | 19 | 'application/json; indent=4' 20 | 'application/json' 21 | 'text/*' 22 | '*/*' 23 | """ 24 | lhs = _MediaType(lhs) 25 | rhs = _MediaType(rhs) 26 | return lhs.match(rhs) 27 | 28 | 29 | def order_by_precedence(media_type_lst): 30 | """ 31 | Returns a list of sets of media type strings, ordered by precedence. 32 | Precedence is determined by how specific a media type is: 33 | 34 | 3. 'type/subtype; param=val' 35 | 2. 'type/subtype' 36 | 1. 'type/*' 37 | 0. '*/*' 38 | """ 39 | ret = [set(), set(), set(), set()] 40 | for media_type in media_type_lst: 41 | precedence = _MediaType(media_type).precedence 42 | ret[3 - precedence].add(media_type) 43 | return [media_types for media_types in ret if media_types] 44 | 45 | 46 | class _MediaType: 47 | def __init__(self, media_type_str): 48 | self.orig = '' if (media_type_str is None) else media_type_str 49 | self.full_type, self.params = parse_header(self.orig.encode(HTTP_HEADER_ENCODING)) 50 | self.main_type, sep, self.sub_type = self.full_type.partition('/') 51 | 52 | def match(self, other): 53 | """Return true if this MediaType satisfies the given MediaType.""" 54 | for key in self.params: 55 | if key != 'q' and other.params.get(key, None) != self.params.get(key, None): 56 | return False 57 | 58 | if self.sub_type != '*' and other.sub_type != '*' and other.sub_type != self.sub_type: 59 | return False 60 | 61 | if self.main_type != '*' and other.main_type != '*' and other.main_type != self.main_type: 62 | return False 63 | 64 | return True 65 | 66 | @property 67 | def precedence(self): 68 | """ 69 | Return a precedence level from 0-3 for the media type given how specific it is. 70 | """ 71 | if self.main_type == '*': 72 | return 0 73 | elif self.sub_type == '*': 74 | return 1 75 | elif not self.params or list(self.params) == ['q']: 76 | return 2 77 | return 3 78 | 79 | def __str__(self): 80 | ret = "%s/%s" % (self.main_type, self.sub_type) 81 | for key, val in self.params.items(): 82 | ret += "; %s=%s" % (key, val.decode('ascii')) 83 | return ret 84 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/login_base.html: -------------------------------------------------------------------------------- 1 | {% extends "rest_framework/base.html" %} 2 | {% load rest_framework %} 3 | 4 | {% block body %} 5 | 6 |
      7 |
      8 |
      9 |
      10 |
      11 | {% block branding %}

      Django REST framework

      {% endblock %} 12 |
      13 |
      14 | 15 |
      16 |
      17 |
      18 | {% csrf_token %} 19 | 20 | 21 |
      22 |
      23 | 24 | 29 | {% if form.username.errors %} 30 |

      31 | {{ form.username.errors|striptags }} 32 |

      33 | {% endif %} 34 |
      35 |
      36 | 37 |
      38 |
      39 | 40 | 41 | {% if form.password.errors %} 42 |

      43 | {{ form.password.errors|striptags }} 44 |

      45 | {% endif %} 46 |
      47 |
      48 | 49 | {% if form.non_field_errors %} 50 | {% for error in form.non_field_errors %} 51 |
      {{ error }}
      52 | {% endfor %} 53 | {% endif %} 54 | 55 |
      56 | 57 |
      58 |
      59 |
      60 |
      61 |
      62 |
      63 |
      64 | 65 | {% endblock %} 66 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/mixins.py: -------------------------------------------------------------------------------- 1 | """ 2 | Basic building blocks for generic class based views. 3 | 4 | We don't bind behaviour to http method handlers yet, 5 | which allows mixin classes to be composed in interesting ways. 6 | """ 7 | from rest_framework import status 8 | from rest_framework.response import Response 9 | from rest_framework.settings import api_settings 10 | 11 | 12 | class CreateModelMixin: 13 | """ 14 | Create a model instance. 15 | """ 16 | def create(self, request, *args, **kwargs): 17 | serializer = self.get_serializer(data=request.data) 18 | serializer.is_valid(raise_exception=True) 19 | self.perform_create(serializer) 20 | headers = self.get_success_headers(serializer.data) 21 | return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers) 22 | 23 | def perform_create(self, serializer): 24 | serializer.save() 25 | 26 | def get_success_headers(self, data): 27 | try: 28 | return {'Location': str(data[api_settings.URL_FIELD_NAME])} 29 | except (TypeError, KeyError): 30 | return {} 31 | 32 | 33 | class ListModelMixin: 34 | """ 35 | List a queryset. 36 | """ 37 | def list(self, request, *args, **kwargs): 38 | queryset = self.filter_queryset(self.get_queryset()) 39 | 40 | page = self.paginate_queryset(queryset) 41 | if page is not None: 42 | serializer = self.get_serializer(page, many=True) 43 | return self.get_paginated_response(serializer.data) 44 | 45 | serializer = self.get_serializer(queryset, many=True) 46 | return Response(serializer.data) 47 | 48 | 49 | class RetrieveModelMixin: 50 | """ 51 | Retrieve a model instance. 52 | """ 53 | def retrieve(self, request, *args, **kwargs): 54 | instance = self.get_object() 55 | serializer = self.get_serializer(instance) 56 | return Response(serializer.data) 57 | 58 | 59 | class UpdateModelMixin: 60 | """ 61 | Update a model instance. 62 | """ 63 | def update(self, request, *args, **kwargs): 64 | partial = kwargs.pop('partial', False) 65 | instance = self.get_object() 66 | serializer = self.get_serializer(instance, data=request.data, partial=partial) 67 | serializer.is_valid(raise_exception=True) 68 | self.perform_update(serializer) 69 | 70 | if getattr(instance, '_prefetched_objects_cache', None): 71 | # If 'prefetch_related' has been applied to a queryset, we need to 72 | # forcibly invalidate the prefetch cache on the instance. 73 | instance._prefetched_objects_cache = {} 74 | 75 | return Response(serializer.data) 76 | 77 | def perform_update(self, serializer): 78 | serializer.save() 79 | 80 | def partial_update(self, request, *args, **kwargs): 81 | kwargs['partial'] = True 82 | return self.update(request, *args, **kwargs) 83 | 84 | 85 | class DestroyModelMixin: 86 | """ 87 | Destroy a model instance. 88 | """ 89 | def destroy(self, request, *args, **kwargs): 90 | instance = self.get_object() 91 | self.perform_destroy(instance) 92 | return Response(status=status.HTTP_204_NO_CONTENT) 93 | 94 | def perform_destroy(self, instance): 95 | instance.delete() 96 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/formatting.py: -------------------------------------------------------------------------------- 1 | """ 2 | Utility functions to return a formatted name and description for a given view. 3 | """ 4 | import re 5 | 6 | from django.utils.encoding import force_str 7 | from django.utils.html import escape 8 | from django.utils.safestring import mark_safe 9 | 10 | from rest_framework.compat import apply_markdown 11 | 12 | 13 | def remove_trailing_string(content, trailing): 14 | """ 15 | Strip trailing component `trailing` from `content` if it exists. 16 | Used when generating names from view classes. 17 | """ 18 | if content.endswith(trailing) and content != trailing: 19 | return content[:-len(trailing)] 20 | return content 21 | 22 | 23 | def dedent(content): 24 | """ 25 | Remove leading indent from a block of text. 26 | Used when generating descriptions from docstrings. 27 | 28 | Note that python's `textwrap.dedent` doesn't quite cut it, 29 | as it fails to dedent multiline docstrings that include 30 | unindented text on the initial line. 31 | """ 32 | content = force_str(content) 33 | lines = [line for line in content.splitlines()[1:] if line.lstrip()] 34 | 35 | # unindent the content if needed 36 | if lines: 37 | whitespace_counts = min([len(line) - len(line.lstrip(' ')) for line in lines]) 38 | tab_counts = min([len(line) - len(line.lstrip('\t')) for line in lines]) 39 | if whitespace_counts: 40 | whitespace_pattern = '^' + (' ' * whitespace_counts) 41 | content = re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', content) 42 | elif tab_counts: 43 | whitespace_pattern = '^' + ('\t' * tab_counts) 44 | content = re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', content) 45 | return content.strip() 46 | 47 | 48 | def camelcase_to_spaces(content): 49 | """ 50 | Translate 'CamelCaseNames' to 'Camel Case Names'. 51 | Used when generating names from view classes. 52 | """ 53 | camelcase_boundary = '(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))' 54 | content = re.sub(camelcase_boundary, ' \\1', content).strip() 55 | return ' '.join(content.split('_')).title() 56 | 57 | 58 | def markup_description(description): 59 | """ 60 | Apply HTML markup to the given description. 61 | """ 62 | if apply_markdown: 63 | description = apply_markdown(description) 64 | else: 65 | description = escape(description).replace('\n', '
      ') 66 | description = '

      ' + description + '

      ' 67 | return mark_safe(description) 68 | 69 | 70 | class lazy_format: 71 | """ 72 | Delay formatting until it's actually needed. 73 | 74 | Useful when the format string or one of the arguments is lazy. 75 | 76 | Not using Django's lazy because it is too slow. 77 | """ 78 | __slots__ = ('format_string', 'args', 'kwargs', 'result') 79 | 80 | def __init__(self, format_string, *args, **kwargs): 81 | self.result = None 82 | self.format_string = format_string 83 | self.args = args 84 | self.kwargs = kwargs 85 | 86 | def __str__(self): 87 | if self.result is None: 88 | self.result = self.format_string.format(*self.args, **self.kwargs) 89 | self.format_string, self.args, self.kwargs = None, None, None 90 | return self.result 91 | 92 | def __mod__(self, value): 93 | return str(self) % value 94 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/documentation.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import include, url 2 | 3 | from rest_framework.renderers import ( 4 | CoreJSONRenderer, DocumentationRenderer, SchemaJSRenderer 5 | ) 6 | from rest_framework.schemas import SchemaGenerator, get_schema_view 7 | from rest_framework.settings import api_settings 8 | 9 | 10 | def get_docs_view( 11 | title=None, description=None, schema_url=None, urlconf=None, 12 | public=True, patterns=None, generator_class=SchemaGenerator, 13 | authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, 14 | permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES, 15 | renderer_classes=None): 16 | 17 | if renderer_classes is None: 18 | renderer_classes = [DocumentationRenderer, CoreJSONRenderer] 19 | 20 | return get_schema_view( 21 | title=title, 22 | url=schema_url, 23 | urlconf=urlconf, 24 | description=description, 25 | renderer_classes=renderer_classes, 26 | public=public, 27 | patterns=patterns, 28 | generator_class=generator_class, 29 | authentication_classes=authentication_classes, 30 | permission_classes=permission_classes, 31 | ) 32 | 33 | 34 | def get_schemajs_view( 35 | title=None, description=None, schema_url=None, urlconf=None, 36 | public=True, patterns=None, generator_class=SchemaGenerator, 37 | authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, 38 | permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES): 39 | renderer_classes = [SchemaJSRenderer] 40 | 41 | return get_schema_view( 42 | title=title, 43 | url=schema_url, 44 | urlconf=urlconf, 45 | description=description, 46 | renderer_classes=renderer_classes, 47 | public=public, 48 | patterns=patterns, 49 | generator_class=generator_class, 50 | authentication_classes=authentication_classes, 51 | permission_classes=permission_classes, 52 | ) 53 | 54 | 55 | def include_docs_urls( 56 | title=None, description=None, schema_url=None, urlconf=None, 57 | public=True, patterns=None, generator_class=SchemaGenerator, 58 | authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, 59 | permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES, 60 | renderer_classes=None): 61 | docs_view = get_docs_view( 62 | title=title, 63 | description=description, 64 | schema_url=schema_url, 65 | urlconf=urlconf, 66 | public=public, 67 | patterns=patterns, 68 | generator_class=generator_class, 69 | authentication_classes=authentication_classes, 70 | renderer_classes=renderer_classes, 71 | permission_classes=permission_classes, 72 | ) 73 | schema_js_view = get_schemajs_view( 74 | title=title, 75 | description=description, 76 | schema_url=schema_url, 77 | urlconf=urlconf, 78 | public=public, 79 | patterns=patterns, 80 | generator_class=generator_class, 81 | authentication_classes=authentication_classes, 82 | permission_classes=permission_classes, 83 | ) 84 | urls = [ 85 | url(r'^$', docs_view, name='docs-index'), 86 | url(r'^schema.js$', schema_js_view, name='schema-js') 87 | ] 88 | return include((urls, 'api-docs'), namespace='api-docs') 89 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/representation.py: -------------------------------------------------------------------------------- 1 | """ 2 | Helper functions for creating user-friendly representations 3 | of serializer classes and serializer fields. 4 | """ 5 | import re 6 | 7 | from django.db import models 8 | from django.utils.encoding import force_str 9 | from django.utils.functional import Promise 10 | 11 | 12 | def manager_repr(value): 13 | model = value.model 14 | opts = model._meta 15 | names_and_managers = [ 16 | (manager.name, manager) 17 | for manager 18 | in opts.managers 19 | ] 20 | for manager_name, manager_instance in names_and_managers: 21 | if manager_instance == value: 22 | return '%s.%s.all()' % (model._meta.object_name, manager_name) 23 | return repr(value) 24 | 25 | 26 | def smart_repr(value): 27 | if isinstance(value, models.Manager): 28 | return manager_repr(value) 29 | 30 | if isinstance(value, Promise) and value._delegate_text: 31 | value = force_str(value) 32 | 33 | value = repr(value) 34 | 35 | # Representations like u'help text' 36 | # should simply be presented as 'help text' 37 | if value.startswith("u'") and value.endswith("'"): 38 | return value[1:] 39 | 40 | # Representations like 41 | # 42 | # Should be presented as 43 | # 44 | return re.sub(' at 0x[0-9A-Fa-f]{4,32}>', '>', value) 45 | 46 | 47 | def field_repr(field, force_many=False): 48 | kwargs = field._kwargs 49 | if force_many: 50 | kwargs = kwargs.copy() 51 | kwargs['many'] = True 52 | kwargs.pop('child', None) 53 | 54 | arg_string = ', '.join([smart_repr(val) for val in field._args]) 55 | kwarg_string = ', '.join([ 56 | '%s=%s' % (key, smart_repr(val)) 57 | for key, val in sorted(kwargs.items()) 58 | ]) 59 | if arg_string and kwarg_string: 60 | arg_string += ', ' 61 | 62 | if force_many: 63 | class_name = force_many.__class__.__name__ 64 | else: 65 | class_name = field.__class__.__name__ 66 | 67 | return "%s(%s%s)" % (class_name, arg_string, kwarg_string) 68 | 69 | 70 | def serializer_repr(serializer, indent, force_many=None): 71 | ret = field_repr(serializer, force_many) + ':' 72 | indent_str = ' ' * indent 73 | 74 | if force_many: 75 | fields = force_many.fields 76 | else: 77 | fields = serializer.fields 78 | 79 | for field_name, field in fields.items(): 80 | ret += '\n' + indent_str + field_name + ' = ' 81 | if hasattr(field, 'fields'): 82 | ret += serializer_repr(field, indent + 1) 83 | elif hasattr(field, 'child'): 84 | ret += list_repr(field, indent + 1) 85 | elif hasattr(field, 'child_relation'): 86 | ret += field_repr(field.child_relation, force_many=field.child_relation) 87 | else: 88 | ret += field_repr(field) 89 | 90 | if serializer.validators: 91 | ret += '\n' + indent_str + 'class Meta:' 92 | ret += '\n' + indent_str + ' validators = ' + smart_repr(serializer.validators) 93 | 94 | return ret 95 | 96 | 97 | def list_repr(serializer, indent): 98 | child = serializer.child 99 | if hasattr(child, 'fields'): 100 | return serializer_repr(serializer, indent, force_many=child) 101 | return field_repr(serializer) 102 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/response.py: -------------------------------------------------------------------------------- 1 | """ 2 | The Response class in REST framework is similar to HTTPResponse, except that 3 | it is initialized with unrendered data, instead of a pre-rendered string. 4 | 5 | The appropriate renderer is called during Django's template response rendering. 6 | """ 7 | from http.client import responses 8 | 9 | from django.template.response import SimpleTemplateResponse 10 | 11 | from rest_framework.serializers import Serializer 12 | 13 | 14 | class Response(SimpleTemplateResponse): 15 | """ 16 | An HttpResponse that allows its data to be rendered into 17 | arbitrary media types. 18 | """ 19 | 20 | def __init__(self, data=None, status=None, 21 | template_name=None, headers=None, 22 | exception=False, content_type=None): 23 | """ 24 | Alters the init arguments slightly. 25 | For example, drop 'template_name', and instead use 'data'. 26 | 27 | Setting 'renderer' and 'media_type' will typically be deferred, 28 | For example being set automatically by the `APIView`. 29 | """ 30 | super().__init__(None, status=status) 31 | 32 | if isinstance(data, Serializer): 33 | msg = ( 34 | 'You passed a Serializer instance as data, but ' 35 | 'probably meant to pass serialized `.data` or ' 36 | '`.error`. representation.' 37 | ) 38 | raise AssertionError(msg) 39 | 40 | self.data = data 41 | self.template_name = template_name 42 | self.exception = exception 43 | self.content_type = content_type 44 | 45 | if headers: 46 | for name, value in headers.items(): 47 | self[name] = value 48 | 49 | @property 50 | def rendered_content(self): 51 | renderer = getattr(self, 'accepted_renderer', None) 52 | accepted_media_type = getattr(self, 'accepted_media_type', None) 53 | context = getattr(self, 'renderer_context', None) 54 | 55 | assert renderer, ".accepted_renderer not set on Response" 56 | assert accepted_media_type, ".accepted_media_type not set on Response" 57 | assert context is not None, ".renderer_context not set on Response" 58 | context['response'] = self 59 | 60 | media_type = renderer.media_type 61 | charset = renderer.charset 62 | content_type = self.content_type 63 | 64 | if content_type is None and charset is not None: 65 | content_type = "{}; charset={}".format(media_type, charset) 66 | elif content_type is None: 67 | content_type = media_type 68 | self['Content-Type'] = content_type 69 | 70 | ret = renderer.render(self.data, accepted_media_type, context) 71 | if isinstance(ret, str): 72 | assert charset, ( 73 | 'renderer returned unicode, and did not specify ' 74 | 'a charset value.' 75 | ) 76 | return ret.encode(charset) 77 | 78 | if not ret: 79 | del self['Content-Type'] 80 | 81 | return ret 82 | 83 | @property 84 | def status_text(self): 85 | """ 86 | Returns reason text corresponding to our HTTP response status code. 87 | Provided for convenience. 88 | """ 89 | return responses.get(self.status_code, '') 90 | 91 | def __getstate__(self): 92 | """ 93 | Remove attributes from the response that shouldn't be cached. 94 | """ 95 | state = super().__getstate__() 96 | for key in ( 97 | 'accepted_renderer', 'renderer_context', 'resolver_match', 98 | 'client', 'request', 'json', 'wsgi_request' 99 | ): 100 | if key in state: 101 | del state[key] 102 | state['_closable_objects'] = [] 103 | return state 104 | -------------------------------------------------------------------------------- /DjangoCRUDwithMySQL/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for DjangoCRUDwithMySQL project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.7. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '!g2r_pyx(v5um@d^x*qsl8q_9jwt=2k20q58&z9w^66gs#-l(x' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'CRUDapp.apps.CrudappConfig', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'DjangoCRUDwithMySQL.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')] 59 | , 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'DjangoCRUDwithMySQL.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.mysql', 81 | 'NAME': 'students', 82 | 'USER': 'root', 83 | 'PASSWORD': '', 84 | 'HOST': 'localhost', 85 | 'PORT': '3306', 86 | } 87 | } 88 | 89 | 90 | # Password validation 91 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 92 | 93 | AUTH_PASSWORD_VALIDATORS = [ 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 99 | }, 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 102 | }, 103 | { 104 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 105 | }, 106 | ] 107 | 108 | 109 | # Internationalization 110 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 111 | 112 | LANGUAGE_CODE = 'en-us' 113 | 114 | TIME_ZONE = 'UTC' 115 | 116 | USE_I18N = True 117 | 118 | USE_L10N = True 119 | 120 | USE_TZ = True 121 | 122 | 123 | # Static files (CSS, JavaScript, Images) 124 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 125 | 126 | STATIC_URL = '/static/' 127 | 128 | STATICFILES_DIRS = ( 129 | os.path.join(BASE_DIR, 'static'), 130 | ) 131 | -------------------------------------------------------------------------------- /static/script.js: -------------------------------------------------------------------------------- 1 | function getCookie(name) { 2 | var cookieValue = null; 3 | if (document.cookie && document.cookie != '') { 4 | var cookies = document.cookie.split(';'); 5 | for (var i = 0; i < cookies.length; i++) { 6 | var cookie = jQuery.trim(cookies[i]); 7 | // Does this cookie string begin with the name we want? 8 | if (cookie.substring(0, name.length + 1) == (name + '=')) { 9 | cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 10 | break; 11 | } 12 | } 13 | } 14 | return cookieValue; 15 | } 16 | 17 | $(document).ready(function(){ 18 | // console.log("Jquery Working Fine Sir!"); 19 | 20 | // $("#editStudent").on('submit','form',function(e){ 21 | $("#editStudent").click(function(){ 22 | alert("Updating"+this.id); 23 | var cookies = document.cookie.split(";"); 24 | var cookie = cookies[0].split("=") 25 | // console.log("Cookie"+cookie[1]); 26 | 27 | var formdata = new FormData($("#addStudent")[0]); 28 | 29 | $.ajax({ 30 | url:'insert/'+cookie[1], 31 | type:'POST', 32 | processData: false, 33 | cache: false, 34 | contentType: false, 35 | data:formdata, 36 | success:function(data){ 37 | // console.log(data); 38 | alert("Updated"); 39 | $("#addStudent").trigger("reset"); 40 | window.location.href="http://localhost:8000/index"; 41 | $("#submitStudent").css("display","block"); 42 | $("#editStudent").css("display","none"); 43 | } 44 | }); 45 | }); 46 | 47 | $("#addStudent").submit(function(e){ 48 | e.preventDefault(); 49 | var formdata = new FormData(this); 50 | // for(var pair of formData.entries()) { 51 | // console.log(pair[0]+ ', '+ pair[1]); 52 | // } 53 | $.ajax({ 54 | url:'insert/', 55 | type:'POST', 56 | processData: false, 57 | cache: false, 58 | contentType: false, 59 | data:formdata, 60 | success:function(data){ 61 | // console.log(data); 62 | // alert("Inserted"); 63 | $("#addStudent").trigger("reset"); 64 | window.location.href="http://localhost:8000/index"; 65 | } 66 | }); 67 | }); 68 | 69 | $(".editStudent").on('click',function(){ 70 | console.log("Edit Request"); 71 | var sid = this.id.substr(8,9); 72 | document.cookie="sid="+sid; 73 | // console.log(sid); 74 | $.ajaxSetup({ 75 | headers: { "X-CSRFToken": getCookie('csrftoken') } 76 | }); 77 | $.ajax({ 78 | url: 'insert/'+sid, 79 | type: 'PUT', 80 | success: function(data){ 81 | // console.log("Editing"); 82 | // console.log(data) 83 | $("#nameStudent").val(data['name']); 84 | $("#branchStudent").val(data['branch']); 85 | $("#enoStudent").val(data['eno']); 86 | $("#submitStudent").css("display","none"); 87 | $("#editStudent").css("display","block"); 88 | } 89 | }); 90 | 91 | }); 92 | 93 | $(".deleteStudent").on('click',function(){ 94 | // console.log("Delete Request"); 95 | var formdata = new FormData($("#addStudent")[0]); 96 | var sid = this.id.substr(8,9); 97 | $.ajaxSetup({ 98 | headers: { "X-CSRFToken": getCookie('csrftoken') } 99 | }); 100 | $.ajax({ 101 | url: 'delete/'+sid, 102 | type: 'DELETE', 103 | processData: false, 104 | cache: false, 105 | contentType: false, 106 | data:formdata, 107 | success: function(data){ 108 | // console.log("Deleted"); 109 | window.location.href="http://localhost:8000/index"; 110 | } 111 | }); 112 | }); 113 | }); -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/js/ajax-form.js: -------------------------------------------------------------------------------- 1 | function replaceDocument(docString) { 2 | var doc = document.open("text/html"); 3 | 4 | doc.write(docString); 5 | doc.close(); 6 | } 7 | 8 | function doAjaxSubmit(e) { 9 | var form = $(this); 10 | var btn = $(this.clk); 11 | var method = ( 12 | btn.data('method') || 13 | form.data('method') || 14 | form.attr('method') || 'GET' 15 | ).toUpperCase(); 16 | 17 | if (method === 'GET') { 18 | // GET requests can always use standard form submits. 19 | return; 20 | } 21 | 22 | var contentType = 23 | form.find('input[data-override="content-type"]').val() || 24 | form.find('select[data-override="content-type"] option:selected').text(); 25 | 26 | if (method === 'POST' && !contentType) { 27 | // POST requests can use standard form submits, unless we have 28 | // overridden the content type. 29 | return; 30 | } 31 | 32 | // At this point we need to make an AJAX form submission. 33 | e.preventDefault(); 34 | 35 | var url = form.attr('action'); 36 | var data; 37 | 38 | if (contentType) { 39 | data = form.find('[data-override="content"]').val() || '' 40 | 41 | if (contentType === 'multipart/form-data') { 42 | // We need to add a boundary parameter to the header 43 | // We assume the first valid-looking boundary line in the body is correct 44 | // regex is from RFC 2046 appendix A 45 | var boundaryCharNoSpace = "0-9A-Z'()+_,-./:=?"; 46 | var boundaryChar = boundaryCharNoSpace + ' '; 47 | var re = new RegExp('^--([' + boundaryChar + ']{0,69}[' + boundaryCharNoSpace + '])[\\s]*?$', 'im'); 48 | var boundary = data.match(re); 49 | if (boundary !== null) { 50 | contentType += '; boundary="' + boundary[1] + '"'; 51 | } 52 | // Fix textarea.value EOL normalisation (multipart/form-data should use CR+NL, not NL) 53 | data = data.replace(/\n/g, '\r\n'); 54 | } 55 | } else { 56 | contentType = form.attr('enctype') || form.attr('encoding') 57 | 58 | if (contentType === 'multipart/form-data') { 59 | if (!window.FormData) { 60 | alert('Your browser does not support AJAX multipart form submissions'); 61 | return; 62 | } 63 | 64 | // Use the FormData API and allow the content type to be set automatically, 65 | // so it includes the boundary string. 66 | // See https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects 67 | contentType = false; 68 | data = new FormData(form[0]); 69 | } else { 70 | contentType = 'application/x-www-form-urlencoded; charset=UTF-8' 71 | data = form.serialize(); 72 | } 73 | } 74 | 75 | var ret = $.ajax({ 76 | url: url, 77 | method: method, 78 | data: data, 79 | contentType: contentType, 80 | processData: false, 81 | headers: { 82 | 'Accept': 'text/html; q=1.0, */*' 83 | }, 84 | }); 85 | 86 | ret.always(function(data, textStatus, jqXHR) { 87 | if (textStatus != 'success') { 88 | jqXHR = data; 89 | } 90 | 91 | var responseContentType = jqXHR.getResponseHeader("content-type") || ""; 92 | 93 | if (responseContentType.toLowerCase().indexOf('text/html') === 0) { 94 | replaceDocument(jqXHR.responseText); 95 | 96 | try { 97 | // Modify the location and scroll to top, as if after page load. 98 | history.replaceState({}, '', url); 99 | scroll(0, 0); 100 | } catch (err) { 101 | // History API not supported, so redirect. 102 | window.location = url; 103 | } 104 | } else { 105 | // Not HTML content. We can't open this directly, so redirect. 106 | window.location = url; 107 | } 108 | }); 109 | 110 | return ret; 111 | } 112 | 113 | function captureSubmittingElement(e) { 114 | var target = e.target; 115 | var form = this; 116 | 117 | form.clk = target; 118 | } 119 | 120 | $.fn.ajaxForm = function() { 121 | var options = {} 122 | 123 | return this 124 | .unbind('submit.form-plugin click.form-plugin') 125 | .bind('submit.form-plugin', options, doAjaxSubmit) 126 | .bind('click.form-plugin', options, captureSubmittingElement); 127 | }; 128 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/negotiation.py: -------------------------------------------------------------------------------- 1 | """ 2 | Content negotiation deals with selecting an appropriate renderer given the 3 | incoming request. Typically this will be based on the request's Accept header. 4 | """ 5 | from django.http import Http404 6 | 7 | from rest_framework import HTTP_HEADER_ENCODING, exceptions 8 | from rest_framework.settings import api_settings 9 | from rest_framework.utils.mediatypes import ( 10 | _MediaType, media_type_matches, order_by_precedence 11 | ) 12 | 13 | 14 | class BaseContentNegotiation: 15 | def select_parser(self, request, parsers): 16 | raise NotImplementedError('.select_parser() must be implemented') 17 | 18 | def select_renderer(self, request, renderers, format_suffix=None): 19 | raise NotImplementedError('.select_renderer() must be implemented') 20 | 21 | 22 | class DefaultContentNegotiation(BaseContentNegotiation): 23 | settings = api_settings 24 | 25 | def select_parser(self, request, parsers): 26 | """ 27 | Given a list of parsers and a media type, return the appropriate 28 | parser to handle the incoming request. 29 | """ 30 | for parser in parsers: 31 | if media_type_matches(parser.media_type, request.content_type): 32 | return parser 33 | return None 34 | 35 | def select_renderer(self, request, renderers, format_suffix=None): 36 | """ 37 | Given a request and a list of renderers, return a two-tuple of: 38 | (renderer, media type). 39 | """ 40 | # Allow URL style format override. eg. "?format=json 41 | format_query_param = self.settings.URL_FORMAT_OVERRIDE 42 | format = format_suffix or request.query_params.get(format_query_param) 43 | 44 | if format: 45 | renderers = self.filter_renderers(renderers, format) 46 | 47 | accepts = self.get_accept_list(request) 48 | 49 | # Check the acceptable media types against each renderer, 50 | # attempting more specific media types first 51 | # NB. The inner loop here isn't as bad as it first looks :) 52 | # Worst case is we're looping over len(accept_list) * len(self.renderers) 53 | for media_type_set in order_by_precedence(accepts): 54 | for renderer in renderers: 55 | for media_type in media_type_set: 56 | if media_type_matches(renderer.media_type, media_type): 57 | # Return the most specific media type as accepted. 58 | media_type_wrapper = _MediaType(media_type) 59 | if ( 60 | _MediaType(renderer.media_type).precedence > 61 | media_type_wrapper.precedence 62 | ): 63 | # Eg client requests '*/*' 64 | # Accepted media type is 'application/json' 65 | full_media_type = ';'.join( 66 | (renderer.media_type,) + 67 | tuple('{}={}'.format( 68 | key, value.decode(HTTP_HEADER_ENCODING)) 69 | for key, value in media_type_wrapper.params.items())) 70 | return renderer, full_media_type 71 | else: 72 | # Eg client requests 'application/json; indent=8' 73 | # Accepted media type is 'application/json; indent=8' 74 | return renderer, media_type 75 | 76 | raise exceptions.NotAcceptable(available_renderers=renderers) 77 | 78 | def filter_renderers(self, renderers, format): 79 | """ 80 | If there is a '.json' style format suffix, filter the renderers 81 | so that we only negotiation against those that accept that format. 82 | """ 83 | renderers = [renderer for renderer in renderers 84 | if renderer.format == format] 85 | if not renderers: 86 | raise Http404 87 | return renderers 88 | 89 | def get_accept_list(self, request): 90 | """ 91 | Given the incoming request, return a tokenized list of media 92 | type strings. 93 | """ 94 | header = request.META.get('HTTP_ACCEPT', '*/*') 95 | return [token.strip() for token in header.split(',')] 96 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/static/rest_framework/css/bootstrap-tweaks.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This CSS file contains some tweaks specific to the included Bootstrap theme. 4 | It's separate from `style.css` so that it can be easily overridden by replacing 5 | a single block in the template. 6 | 7 | */ 8 | 9 | .form-actions { 10 | background: transparent; 11 | border-top-color: transparent; 12 | padding-top: 0; 13 | text-align: right; 14 | } 15 | 16 | #generic-content-form textarea { 17 | font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace; 18 | font-size: 80%; 19 | } 20 | 21 | .navbar-inverse .brand a { 22 | color: #999999; 23 | } 24 | .navbar-inverse .brand:hover a { 25 | color: white; 26 | text-decoration: none; 27 | } 28 | 29 | /* custom navigation styles */ 30 | .navbar { 31 | width: 100%; 32 | position: fixed; 33 | left: 0; 34 | top: 0; 35 | } 36 | 37 | .navbar { 38 | background: #2C2C2C; 39 | color: white; 40 | border: none; 41 | border-top: 5px solid #A30000; 42 | border-radius: 0px; 43 | } 44 | 45 | .navbar .nav li, .navbar .nav li a, .navbar .brand:hover { 46 | color: white; 47 | } 48 | 49 | .nav-list > .active > a, .nav-list > .active > a:hover { 50 | background: #2C2C2C; 51 | } 52 | 53 | .navbar .dropdown-menu li a, .navbar .dropdown-menu li { 54 | color: #A30000; 55 | } 56 | 57 | .navbar .dropdown-menu li a:hover { 58 | background: #EEEEEE; 59 | color: #C20000; 60 | } 61 | 62 | ul.breadcrumb { 63 | margin: 70px 0 0 0; 64 | } 65 | 66 | .breadcrumb li.active a { 67 | color: #777; 68 | } 69 | 70 | .pagination>.disabled>a, 71 | .pagination>.disabled>a:hover, 72 | .pagination>.disabled>a:focus { 73 | cursor: not-allowed; 74 | pointer-events: none; 75 | } 76 | 77 | .pager>.disabled>a, 78 | .pager>.disabled>a:hover, 79 | .pager>.disabled>a:focus { 80 | pointer-events: none; 81 | } 82 | 83 | .pager .next { 84 | margin-left: 10px; 85 | } 86 | 87 | /*=== dabapps bootstrap styles ====*/ 88 | 89 | html { 90 | width:100%; 91 | background: none; 92 | } 93 | 94 | /*body, .navbar .container-fluid { 95 | max-width: 1150px; 96 | margin: 0 auto; 97 | }*/ 98 | 99 | body { 100 | background: url("../img/grid.png") repeat-x; 101 | background-attachment: fixed; 102 | } 103 | 104 | #content { 105 | margin: 0; 106 | padding-bottom: 60px; 107 | } 108 | 109 | /* sticky footer and footer */ 110 | html, body { 111 | height: 100%; 112 | } 113 | 114 | .wrapper { 115 | position: relative; 116 | top: 0; 117 | left: 0; 118 | padding-top: 60px; 119 | margin: -60px 0; 120 | min-height: 100%; 121 | } 122 | 123 | .form-switcher { 124 | margin-bottom: 0; 125 | } 126 | 127 | .well { 128 | -webkit-box-shadow: none; 129 | -moz-box-shadow: none; 130 | box-shadow: none; 131 | } 132 | 133 | .well .form-actions { 134 | padding-bottom: 0; 135 | margin-bottom: 0; 136 | } 137 | 138 | .well form { 139 | margin-bottom: 0; 140 | } 141 | 142 | .nav-tabs { 143 | border: 0; 144 | } 145 | 146 | .nav-tabs > li { 147 | float: right; 148 | } 149 | 150 | .nav-tabs li a { 151 | margin-right: 0; 152 | } 153 | 154 | .nav-tabs > .active > a { 155 | background: #F5F5F5; 156 | } 157 | 158 | .nav-tabs > .active > a:hover { 159 | background: #F5F5F5; 160 | } 161 | 162 | .tabbable.first-tab-active .tab-content { 163 | border-top-right-radius: 0; 164 | } 165 | 166 | footer { 167 | position: absolute; 168 | bottom: 0; 169 | left: 0; 170 | clear: both; 171 | z-index: 10; 172 | height: 60px; 173 | width: 95%; 174 | margin: 0 2.5%; 175 | } 176 | 177 | footer p { 178 | text-align: center; 179 | color: gray; 180 | border-top: 1px solid #DDDDDD; 181 | padding-top: 10px; 182 | } 183 | 184 | footer a { 185 | color: gray !important; 186 | font-weight: bold; 187 | } 188 | 189 | footer a:hover { 190 | color: gray; 191 | } 192 | 193 | .page-header { 194 | border-bottom: none; 195 | padding-bottom: 0px; 196 | margin: 0; 197 | } 198 | 199 | /* custom general page styles */ 200 | .hero-unit h1, .hero-unit h2 { 201 | color: #A30000; 202 | } 203 | 204 | body a { 205 | color: #A30000; 206 | } 207 | 208 | body a:hover { 209 | color: #c20000; 210 | } 211 | 212 | .request-info { 213 | clear:both; 214 | } 215 | 216 | .horizontal-checkbox label { 217 | padding-top: 0; 218 | } 219 | 220 | .horizontal-checkbox label { 221 | padding-top: 0 !important; 222 | } 223 | 224 | .horizontal-checkbox input { 225 | float: left; 226 | width: 20px; 227 | margin-top: 3px; 228 | } 229 | 230 | .modal-footer form { 231 | margin-left: 5px; 232 | margin-right: 5px; 233 | } 234 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/schemas/inspectors.py: -------------------------------------------------------------------------------- 1 | """ 2 | inspectors.py # Per-endpoint view introspection 3 | 4 | See schemas.__init__.py for package overview. 5 | """ 6 | import re 7 | from weakref import WeakKeyDictionary 8 | 9 | from django.utils.encoding import smart_str 10 | 11 | from rest_framework.settings import api_settings 12 | from rest_framework.utils import formatting 13 | 14 | 15 | class ViewInspector: 16 | """ 17 | Descriptor class on APIView. 18 | 19 | Provide subclass for per-view schema generation 20 | """ 21 | 22 | # Used in _get_description_section() 23 | header_regex = re.compile('^[a-zA-Z][0-9A-Za-z_]*:') 24 | 25 | def __init__(self): 26 | self.instance_schemas = WeakKeyDictionary() 27 | 28 | def __get__(self, instance, owner): 29 | """ 30 | Enables `ViewInspector` as a Python _Descriptor_. 31 | 32 | This is how `view.schema` knows about `view`. 33 | 34 | `__get__` is called when the descriptor is accessed on the owner. 35 | (That will be when view.schema is called in our case.) 36 | 37 | `owner` is always the owner class. (An APIView, or subclass for us.) 38 | `instance` is the view instance or `None` if accessed from the class, 39 | rather than an instance. 40 | 41 | See: https://docs.python.org/3/howto/descriptor.html for info on 42 | descriptor usage. 43 | """ 44 | if instance in self.instance_schemas: 45 | return self.instance_schemas[instance] 46 | 47 | self.view = instance 48 | return self 49 | 50 | def __set__(self, instance, other): 51 | self.instance_schemas[instance] = other 52 | if other is not None: 53 | other.view = instance 54 | 55 | @property 56 | def view(self): 57 | """View property.""" 58 | assert self._view is not None, ( 59 | "Schema generation REQUIRES a view instance. (Hint: you accessed " 60 | "`schema` from the view class rather than an instance.)" 61 | ) 62 | return self._view 63 | 64 | @view.setter 65 | def view(self, value): 66 | self._view = value 67 | 68 | @view.deleter 69 | def view(self): 70 | self._view = None 71 | 72 | def get_description(self, path, method): 73 | """ 74 | Determine a path description. 75 | 76 | This will be based on the method docstring if one exists, 77 | or else the class docstring. 78 | """ 79 | view = self.view 80 | 81 | method_name = getattr(view, 'action', method.lower()) 82 | method_docstring = getattr(view, method_name, None).__doc__ 83 | if method_docstring: 84 | # An explicit docstring on the method or action. 85 | return self._get_description_section(view, method.lower(), formatting.dedent(smart_str(method_docstring))) 86 | else: 87 | return self._get_description_section(view, getattr(view, 'action', method.lower()), 88 | view.get_view_description()) 89 | 90 | def _get_description_section(self, view, header, description): 91 | lines = [line for line in description.splitlines()] 92 | current_section = '' 93 | sections = {'': ''} 94 | 95 | for line in lines: 96 | if self.header_regex.match(line): 97 | current_section, separator, lead = line.partition(':') 98 | sections[current_section] = lead.strip() 99 | else: 100 | sections[current_section] += '\n' + line 101 | 102 | # TODO: SCHEMA_COERCE_METHOD_NAMES appears here and in `SchemaGenerator.get_keys` 103 | coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES 104 | if header in sections: 105 | return sections[header].strip() 106 | if header in coerce_method_names: 107 | if coerce_method_names[header] in sections: 108 | return sections[coerce_method_names[header]].strip() 109 | return sections[''].strip() 110 | 111 | 112 | class DefaultSchema(ViewInspector): 113 | """Allows overriding AutoSchema using DEFAULT_SCHEMA_CLASS setting""" 114 | def __get__(self, instance, owner): 115 | result = super().__get__(instance, owner) 116 | if not isinstance(result, DefaultSchema): 117 | return result 118 | 119 | inspector_class = api_settings.DEFAULT_SCHEMA_CLASS 120 | assert issubclass(inspector_class, ViewInspector), ( 121 | "DEFAULT_SCHEMA_CLASS must be set to a ViewInspector (usually an AutoSchema) subclass" 122 | ) 123 | inspector = inspector_class() 124 | inspector.view = instance 125 | return inspector 126 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/urlpatterns.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import include, url 2 | 3 | from rest_framework.compat import ( 4 | URLResolver, get_regex_pattern, is_route_pattern, path, register_converter 5 | ) 6 | from rest_framework.settings import api_settings 7 | 8 | 9 | def _get_format_path_converter(suffix_kwarg, allowed): 10 | if allowed: 11 | if len(allowed) == 1: 12 | allowed_pattern = allowed[0] 13 | else: 14 | allowed_pattern = '(?:%s)' % '|'.join(allowed) 15 | suffix_pattern = r"\.%s/?" % allowed_pattern 16 | else: 17 | suffix_pattern = r"\.[a-z0-9]+/?" 18 | 19 | class FormatSuffixConverter: 20 | regex = suffix_pattern 21 | 22 | def to_python(self, value): 23 | return value.strip('./') 24 | 25 | def to_url(self, value): 26 | return '.' + value + '/' 27 | 28 | converter_name = 'drf_format_suffix' 29 | if allowed: 30 | converter_name += '_' + '_'.join(allowed) 31 | 32 | return converter_name, FormatSuffixConverter 33 | 34 | 35 | def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route=None): 36 | ret = [] 37 | for urlpattern in urlpatterns: 38 | if isinstance(urlpattern, URLResolver): 39 | # Set of included URL patterns 40 | regex = get_regex_pattern(urlpattern) 41 | namespace = urlpattern.namespace 42 | app_name = urlpattern.app_name 43 | kwargs = urlpattern.default_kwargs 44 | # Add in the included patterns, after applying the suffixes 45 | patterns = apply_suffix_patterns(urlpattern.url_patterns, 46 | suffix_pattern, 47 | suffix_required, 48 | suffix_route) 49 | 50 | # if the original pattern was a RoutePattern we need to preserve it 51 | if is_route_pattern(urlpattern): 52 | assert path is not None 53 | route = str(urlpattern.pattern) 54 | new_pattern = path(route, include((patterns, app_name), namespace), kwargs) 55 | else: 56 | new_pattern = url(regex, include((patterns, app_name), namespace), kwargs) 57 | 58 | ret.append(new_pattern) 59 | else: 60 | # Regular URL pattern 61 | regex = get_regex_pattern(urlpattern).rstrip('$').rstrip('/') + suffix_pattern 62 | view = urlpattern.callback 63 | kwargs = urlpattern.default_args 64 | name = urlpattern.name 65 | # Add in both the existing and the new urlpattern 66 | if not suffix_required: 67 | ret.append(urlpattern) 68 | 69 | # if the original pattern was a RoutePattern we need to preserve it 70 | if is_route_pattern(urlpattern): 71 | assert path is not None 72 | assert suffix_route is not None 73 | route = str(urlpattern.pattern).rstrip('$').rstrip('/') + suffix_route 74 | new_pattern = path(route, view, kwargs, name) 75 | else: 76 | new_pattern = url(regex, view, kwargs, name) 77 | 78 | ret.append(new_pattern) 79 | 80 | return ret 81 | 82 | 83 | def format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None): 84 | """ 85 | Supplement existing urlpatterns with corresponding patterns that also 86 | include a '.format' suffix. Retains urlpattern ordering. 87 | 88 | urlpatterns: 89 | A list of URL patterns. 90 | 91 | suffix_required: 92 | If `True`, only suffixed URLs will be generated, and non-suffixed 93 | URLs will not be used. Defaults to `False`. 94 | 95 | allowed: 96 | An optional tuple/list of allowed suffixes. eg ['json', 'api'] 97 | Defaults to `None`, which allows any suffix. 98 | """ 99 | suffix_kwarg = api_settings.FORMAT_SUFFIX_KWARG 100 | if allowed: 101 | if len(allowed) == 1: 102 | allowed_pattern = allowed[0] 103 | else: 104 | allowed_pattern = '(%s)' % '|'.join(allowed) 105 | suffix_pattern = r'\.(?P<%s>%s)/?$' % (suffix_kwarg, allowed_pattern) 106 | else: 107 | suffix_pattern = r'\.(?P<%s>[a-z0-9]+)/?$' % suffix_kwarg 108 | 109 | if path and register_converter: 110 | converter_name, suffix_converter = _get_format_path_converter(suffix_kwarg, allowed) 111 | register_converter(suffix_converter, converter_name) 112 | 113 | suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg) 114 | else: 115 | suffix_route = None 116 | 117 | return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route) 118 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/templates/rest_framework/docs/link.html: -------------------------------------------------------------------------------- 1 | {% load rest_framework %} 2 | 101 | 102 | {% include "rest_framework/docs/interact.html" with link=link %} 103 | -------------------------------------------------------------------------------- /venv/lib/python3.7/site-packages/rest_framework/utils/serializer_helpers.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | from collections.abc import MutableMapping 3 | 4 | from django.utils.encoding import force_str 5 | 6 | from rest_framework.utils import json 7 | 8 | 9 | class ReturnDict(OrderedDict): 10 | """ 11 | Return object from `serializer.data` for the `Serializer` class. 12 | Includes a backlink to the serializer instance for renderers 13 | to use if they need richer field information. 14 | """ 15 | 16 | def __init__(self, *args, **kwargs): 17 | self.serializer = kwargs.pop('serializer') 18 | super().__init__(*args, **kwargs) 19 | 20 | def copy(self): 21 | return ReturnDict(self, serializer=self.serializer) 22 | 23 | def __repr__(self): 24 | return dict.__repr__(self) 25 | 26 | def __reduce__(self): 27 | # Pickling these objects will drop the .serializer backlink, 28 | # but preserve the raw data. 29 | return (dict, (dict(self),)) 30 | 31 | 32 | class ReturnList(list): 33 | """ 34 | Return object from `serializer.data` for the `SerializerList` class. 35 | Includes a backlink to the serializer instance for renderers 36 | to use if they need richer field information. 37 | """ 38 | 39 | def __init__(self, *args, **kwargs): 40 | self.serializer = kwargs.pop('serializer') 41 | super().__init__(*args, **kwargs) 42 | 43 | def __repr__(self): 44 | return list.__repr__(self) 45 | 46 | def __reduce__(self): 47 | # Pickling these objects will drop the .serializer backlink, 48 | # but preserve the raw data. 49 | return (list, (list(self),)) 50 | 51 | 52 | class BoundField: 53 | """ 54 | A field object that also includes `.value` and `.error` properties. 55 | Returned when iterating over a serializer instance, 56 | providing an API similar to Django forms and form fields. 57 | """ 58 | 59 | def __init__(self, field, value, errors, prefix=''): 60 | self._field = field 61 | self._prefix = prefix 62 | self.value = value 63 | self.errors = errors 64 | self.name = prefix + self.field_name 65 | 66 | def __getattr__(self, attr_name): 67 | return getattr(self._field, attr_name) 68 | 69 | @property 70 | def _proxy_class(self): 71 | return self._field.__class__ 72 | 73 | def __repr__(self): 74 | return '<%s value=%s errors=%s>' % ( 75 | self.__class__.__name__, self.value, self.errors 76 | ) 77 | 78 | def as_form_field(self): 79 | value = '' if (self.value is None or self.value is False) else self.value 80 | return self.__class__(self._field, value, self.errors, self._prefix) 81 | 82 | 83 | class JSONBoundField(BoundField): 84 | def as_form_field(self): 85 | value = self.value 86 | # When HTML form input is used and the input is not valid 87 | # value will be a JSONString, rather than a JSON primitive. 88 | if not getattr(value, 'is_json_string', False): 89 | try: 90 | value = json.dumps(self.value, sort_keys=True, indent=4) 91 | except (TypeError, ValueError): 92 | pass 93 | return self.__class__(self._field, value, self.errors, self._prefix) 94 | 95 | 96 | class NestedBoundField(BoundField): 97 | """ 98 | This `BoundField` additionally implements __iter__ and __getitem__ 99 | in order to support nested bound fields. This class is the type of 100 | `BoundField` that is used for serializer fields. 101 | """ 102 | 103 | def __init__(self, field, value, errors, prefix=''): 104 | if value is None or value == '': 105 | value = {} 106 | super().__init__(field, value, errors, prefix) 107 | 108 | def __iter__(self): 109 | for field in self.fields.values(): 110 | yield self[field.field_name] 111 | 112 | def __getitem__(self, key): 113 | field = self.fields[key] 114 | value = self.value.get(key) if self.value else None 115 | error = self.errors.get(key) if isinstance(self.errors, dict) else None 116 | if hasattr(field, 'fields'): 117 | return NestedBoundField(field, value, error, prefix=self.name + '.') 118 | return BoundField(field, value, error, prefix=self.name + '.') 119 | 120 | def as_form_field(self): 121 | values = {} 122 | for key, value in self.value.items(): 123 | if isinstance(value, (list, dict)): 124 | values[key] = value 125 | else: 126 | values[key] = '' if (value is None or value is False) else force_str(value) 127 | return self.__class__(self._field, values, self.errors, self._prefix) 128 | 129 | 130 | class BindingDict(MutableMapping): 131 | """ 132 | This dict-like object is used to store fields on a serializer. 133 | 134 | This ensures that whenever fields are added to the serializer we call 135 | `field.bind()` so that the `field_name` and `parent` attributes 136 | can be set correctly. 137 | """ 138 | 139 | def __init__(self, serializer): 140 | self.serializer = serializer 141 | self.fields = OrderedDict() 142 | 143 | def __setitem__(self, key, field): 144 | self.fields[key] = field 145 | field.bind(field_name=key, parent=self.serializer) 146 | 147 | def __getitem__(self, key): 148 | return self.fields[key] 149 | 150 | def __delitem__(self, key): 151 | del self.fields[key] 152 | 153 | def __iter__(self): 154 | return iter(self.fields) 155 | 156 | def __len__(self): 157 | return len(self.fields) 158 | 159 | def __repr__(self): 160 | return dict.__repr__(self.fields) 161 | --------------------------------------------------------------------------------