├── Core
├── __init__.py
├── asgi.py
├── wsgi.py
├── urls.py
└── settings.py
├── cardapp
├── __init__.py
├── tests.py
├── apps.py
├── urls.py
├── models.py
├── admin.py
├── serializers.py
└── views.py
├── usersapp
├── __init__.py
├── management
│ ├── __init__.py
│ └── commands
│ │ ├── __init__.py
│ │ └── get_users.py
├── apps.py
├── admin.py
├── urls.py
├── serializers.py
├── models.py
├── test_users.py
└── views.py
├── README.md
├── pytest.ini
├── staticfiles
├── rest_framework
│ ├── js
│ │ ├── load-ajax-form.js
│ │ ├── default.js
│ │ ├── csrf.js
│ │ └── ajax-form.js
│ ├── 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
├── jazzmin
│ ├── img
│ │ ├── default.jpg
│ │ ├── icon-changelink.svg
│ │ ├── icon-calendar.svg
│ │ ├── calendar-icons.svg
│ │ └── selector-icons.svg
│ ├── js
│ │ ├── change_list.js
│ │ ├── main.js
│ │ ├── change_form.js
│ │ └── related-modal.js
│ └── plugins
│ │ └── bootstrap-show-modal
│ │ └── bootstrap-show-modal.min.js
├── vendor
│ ├── adminlte
│ │ └── img
│ │ │ ├── icons.png
│ │ │ ├── AdminLTELogo.png
│ │ │ └── user2-160x160.jpg
│ └── fontawesome-free
│ │ └── webfonts
│ │ ├── fa-solid-900.ttf
│ │ ├── fa-brands-400.ttf
│ │ ├── fa-brands-400.woff2
│ │ ├── fa-regular-400.ttf
│ │ ├── fa-solid-900.woff2
│ │ ├── fa-regular-400.woff2
│ │ ├── fa-v4compatibility.ttf
│ │ └── fa-v4compatibility.woff2
└── admin
│ ├── img
│ ├── tooltag-arrowright.svg
│ ├── README.txt
│ ├── icon-addlink.svg
│ ├── tooltag-add.svg
│ ├── icon-changelink.svg
│ ├── icon-deletelink.svg
│ ├── icon-yes.svg
│ ├── search.svg
│ ├── icon-alert.svg
│ ├── icon-no.svg
│ ├── inline-delete.svg
│ ├── icon-viewlink.svg
│ ├── icon-unknown.svg
│ ├── icon-unknown-alt.svg
│ ├── icon-clock.svg
│ ├── gis
│ │ ├── move_vertex_on.svg
│ │ └── move_vertex_off.svg
│ ├── icon-calendar.svg
│ ├── calendar-icons.svg
│ ├── LICENSE
│ ├── sorting-icons.svg
│ └── selector-icons.svg
│ ├── js
│ ├── jquery.init.js
│ ├── vendor
│ │ ├── select2
│ │ │ ├── i18n
│ │ │ │ ├── zh-TW.js
│ │ │ │ ├── zh-CN.js
│ │ │ │ ├── ja.js
│ │ │ │ ├── az.js
│ │ │ │ ├── ko.js
│ │ │ │ ├── vi.js
│ │ │ │ ├── tk.js
│ │ │ │ ├── id.js
│ │ │ │ ├── tr.js
│ │ │ │ ├── ar.js
│ │ │ │ ├── th.js
│ │ │ │ ├── nb.js
│ │ │ │ ├── km.js
│ │ │ │ ├── sv.js
│ │ │ │ ├── fi.js
│ │ │ │ ├── is.js
│ │ │ │ ├── et.js
│ │ │ │ ├── hu.js
│ │ │ │ ├── ms.js
│ │ │ │ ├── ka.js
│ │ │ │ ├── bg.js
│ │ │ │ ├── da.js
│ │ │ │ ├── hy.js
│ │ │ │ ├── fa.js
│ │ │ │ ├── en.js
│ │ │ │ ├── hi.js
│ │ │ │ ├── he.js
│ │ │ │ ├── hr.js
│ │ │ │ ├── de.js
│ │ │ │ ├── af.js
│ │ │ │ ├── eu.js
│ │ │ │ ├── mk.js
│ │ │ │ ├── pt-BR.js
│ │ │ │ ├── pt.js
│ │ │ │ ├── bn.js
│ │ │ │ ├── lv.js
│ │ │ │ ├── ca.js
│ │ │ │ ├── ps.js
│ │ │ │ ├── sq.js
│ │ │ │ ├── it.js
│ │ │ │ ├── nl.js
│ │ │ │ ├── ne.js
│ │ │ │ ├── fr.js
│ │ │ │ ├── es.js
│ │ │ │ ├── gl.js
│ │ │ │ ├── sl.js
│ │ │ │ ├── ro.js
│ │ │ │ ├── lt.js
│ │ │ │ ├── pl.js
│ │ │ │ ├── el.js
│ │ │ │ ├── sr.js
│ │ │ │ ├── uk.js
│ │ │ │ ├── bs.js
│ │ │ │ ├── sr-Cyrl.js
│ │ │ │ ├── ru.js
│ │ │ │ ├── hsb.js
│ │ │ │ ├── dsb.js
│ │ │ │ ├── cs.js
│ │ │ │ └── sk.js
│ │ │ └── LICENSE.md
│ │ ├── jquery
│ │ │ └── LICENSE.txt
│ │ └── xregexp
│ │ │ └── LICENSE.txt
│ ├── cancel.js
│ ├── prepopulate_init.js
│ ├── change_form.js
│ ├── filters.js
│ ├── autocomplete.js
│ ├── prepopulate.js
│ ├── popup_response.js
│ ├── collapse.js
│ ├── theme.js
│ ├── nav_sidebar.js
│ ├── SelectBox.js
│ └── core.js
│ └── css
│ ├── dashboard.css
│ ├── vendor
│ └── select2
│ │ └── LICENSE-SELECT2.md
│ ├── login.css
│ ├── responsive_rtl.css
│ ├── nav_sidebar.css
│ ├── dark_mode.css
│ └── rtl.css
├── conftest.py
├── requirements.txt
├── manage.py
├── uzum.sh
└── .gitignore
/Core/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/cardapp/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/usersapp/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Uzumbank
2 |
--------------------------------------------------------------------------------
/usersapp/management/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/usersapp/management/commands/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/cardapp/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | DJANGO_SETTINGS_MODULE = Core.settings
3 | python_files = test_*.py *_test.py
4 |
--------------------------------------------------------------------------------
/staticfiles/rest_framework/js/load-ajax-form.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $('form').ajaxForm();
3 | });
4 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/img/default.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/jazzmin/img/default.jpg
--------------------------------------------------------------------------------
/staticfiles/rest_framework/img/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/img/grid.png
--------------------------------------------------------------------------------
/staticfiles/vendor/adminlte/img/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/adminlte/img/icons.png
--------------------------------------------------------------------------------
/staticfiles/rest_framework/docs/img/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/docs/img/grid.png
--------------------------------------------------------------------------------
/staticfiles/rest_framework/docs/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/docs/img/favicon.ico
--------------------------------------------------------------------------------
/staticfiles/vendor/adminlte/img/AdminLTELogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/adminlte/img/AdminLTELogo.png
--------------------------------------------------------------------------------
/staticfiles/vendor/adminlte/img/user2-160x160.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/adminlte/img/user2-160x160.jpg
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/staticfiles/rest_framework/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/staticfiles/rest_framework/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-solid-900.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-solid-900.ttf
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-brands-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-brands-400.ttf
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-brands-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-brands-400.woff2
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-regular-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-regular-400.ttf
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-solid-900.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-solid-900.woff2
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-regular-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-regular-400.woff2
--------------------------------------------------------------------------------
/cardapp/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class CardappConfig(AppConfig):
5 | default_auto_field = 'django.db.models.BigAutoField'
6 | name = 'cardapp'
7 |
--------------------------------------------------------------------------------
/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/rest_framework/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-v4compatibility.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-v4compatibility.ttf
--------------------------------------------------------------------------------
/staticfiles/vendor/fontawesome-free/webfonts/fa-v4compatibility.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/d1yas/UzumBank/HEAD/staticfiles/vendor/fontawesome-free/webfonts/fa-v4compatibility.woff2
--------------------------------------------------------------------------------
/usersapp/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class UsersappConfig(AppConfig):
5 | default_auto_field = 'django.db.models.BigAutoField'
6 | name = 'usersapp'
7 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/tooltag-arrowright.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/conftest.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | import django
3 | from django.conf import settings
4 |
5 | @pytest.fixture(scope='session', autouse=True)
6 | def setup_django():
7 | if not settings.configured: # ⚡️ Oldin sozlanganini tekshiramiz
8 | settings.configure(DJANGO_SETTINGS_MODULE="Core.settings")
9 | django.setup() # ⚡️ Django ni ishga tushirish
10 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/README.txt:
--------------------------------------------------------------------------------
1 | All icons are taken from Font Awesome (http://fontawesome.io/) project.
2 | The Font Awesome font is licensed under the SIL OFL 1.1:
3 | - https://scripts.sil.org/OFL
4 |
5 | SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG
6 | Font-Awesome-SVG-PNG is licensed under the MIT license (see file license
7 | in current folder).
8 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-addlink.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/tooltag-add.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/jquery.init.js:
--------------------------------------------------------------------------------
1 | /*global jQuery:false*/
2 | 'use strict';
3 | /* Puts the included jQuery into our own namespace using noConflict and passing
4 | * it 'true'. This ensures that the included jQuery doesn't pollute the global
5 | * namespace (i.e. this preserves pre-existing values for both window.$ and
6 | * window.jQuery).
7 | */
8 | window.django = {jQuery: jQuery.noConflict(true)};
9 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-changelink.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/img/icon-changelink.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-deletelink.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/Core/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for Core project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Core.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Core/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for Core project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Core.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-yes.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.8.1
2 | certifi==2025.1.31
3 | charset-normalizer==3.4.1
4 | Django==4.2.17
5 | django-jazzmin==3.0.1
6 | django-sslserver==0.22
7 | djangorestframework==3.15.2
8 | exceptiongroup==1.2.2
9 | idna==3.10
10 | iniconfig==2.0.0
11 | packaging==24.2
12 | pluggy==1.5.0
13 | pytest==8.3.5
14 | pytest-django==4.10.0
15 | requests==2.32.3
16 | sqlparse==0.5.3
17 | tomli==2.2.1
18 | typing_extensions==4.12.2
19 | urllib3==2.3.0
20 | whitenoise==6.8.2
21 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/search.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-alert.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-no.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/inline-delete.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/css/dashboard.css:
--------------------------------------------------------------------------------
1 | /* DASHBOARD */
2 | .dashboard td, .dashboard th {
3 | word-break: break-word;
4 | }
5 |
6 | .dashboard .module table th {
7 | width: 100%;
8 | }
9 |
10 | .dashboard .module table td {
11 | white-space: nowrap;
12 | }
13 |
14 | .dashboard .module table td a {
15 | display: block;
16 | padding-right: .6em;
17 | }
18 |
19 | /* RECENT ACTIONS MODULE */
20 |
21 | .module ul.actionlist {
22 | margin-left: 0;
23 | }
24 |
25 | ul.actionlist li {
26 | list-style-type: none;
27 | overflow: hidden;
28 | text-overflow: ellipsis;
29 | }
30 |
--------------------------------------------------------------------------------
/cardapp/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path
2 | from .views import barcha_card, Transacsion, UpdatePasswordCardAPI, AddMoneyApi, AddCard
3 |
4 | urlpatterns = [
5 | path('all_card/', barcha_card.as_view()),
6 | path('transacsion/', Transacsion.as_view()),
7 | path('card_update_password/', UpdatePasswordCardAPI.as_view()),
8 | path('add_money_api/', AddMoneyApi.as_view()),
9 | # path('all_card', All_Card.as_view()),
10 | path('add_card', AddCard.as_view())
11 | # path('delete_card/', DeleteCard.as_view()),
12 | # path('update_card',UpdateCardAPI.as_view())
13 |
14 | ]
15 | #
16 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-viewlink.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/zh-TW.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(n){return"請刪掉"+(n.input.length-n.maximum)+"個字元"},inputTooShort:function(n){return"請再輸入"+(n.minimum-n.input.length)+"個字元"},loadingMore:function(){return"載入中…"},maximumSelected:function(n){return"你只能選擇最多"+n.maximum+"項"},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"},removeAllItems:function(){return"刪除所有項目"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/cancel.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | 'use strict';
3 |
4 | $(document).ready(function() {
5 | $('.cancel-link').click(function(e) {
6 | e.preventDefault();
7 | const parentWindow = window.parent;
8 | if (parentWindow && typeof(parentWindow.dismissRelatedObjectModal) === 'function' && parentWindow !== window) {
9 | parentWindow.dismissRelatedObjectModal();
10 | } else {
11 | // fallback to default behavior
12 | window.history.back();
13 | }
14 | return false;
15 | });
16 | });
17 | })(django.jQuery);
18 |
--------------------------------------------------------------------------------
/usersapp/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from .models import User
3 |
4 |
5 | class UserAdmin(admin.ModelAdmin):
6 | list_display = ('first_name', 'last_name', 'birth_year', 'birth_month', 'birth_days',)
7 | search_fields = ('first_name', 'last_name')
8 | list_filter = ('birth_year', 'birth_month')
9 | empty_value_display = "-empty-"
10 |
11 | fieldsets = (
12 | ('User Info', {
13 | 'fields': ('first_name', 'last_name', 'birth_year', 'birth_month', 'birth_days')
14 | }),
15 | ('Security', {
16 | 'fields': ('password',)
17 | })
18 | )
19 |
20 | admin.site.register(User, UserAdmin)
21 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/prepopulate_init.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | {
3 | const $ = django.jQuery;
4 | const fields = $('#django-admin-prepopulated-fields-constants').data('prepopulatedFields');
5 | $.each(fields, function(index, field) {
6 | $(
7 | '.empty-form .form-row .field-' + field.name +
8 | ', .empty-form.form-row .field-' + field.name +
9 | ', .empty-form .form-row.field-' + field.name
10 | ).addClass('prepopulated_field');
11 | $(field.id).data('dependency_list', field.dependency_list).prepopulate(
12 | field.dependency_ids, field.maxLength, field.allowUnicode
13 | );
14 | });
15 | }
16 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-unknown.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-unknown-alt.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/usersapp/management/commands/get_users.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import json
3 | from django.core.management.base import BaseCommand
4 |
5 | class Command(BaseCommand):
6 | help = "API orqali barcha foydalanuvchilarni olish"
7 |
8 | def handle(self, *args, **kwargs):
9 | url = "http://127.0.0.1:8000/user/allusers/" # URL ni to‘g‘riladik
10 | response = requests.get(url)
11 |
12 | if response.status_code == 200:
13 | users = response.json()
14 | self.stdout.write(self.style.SUCCESS(json.dumps(users, indent=2)))
15 | else:
16 | self.stdout.write(self.style.ERROR(f"Xatolik: {response.status_code} - {response.text}"))
17 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/change_form.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | {
3 | const inputTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
4 | const modelName = document.getElementById('django-admin-form-add-constants').dataset.modelName;
5 | if (modelName) {
6 | const form = document.getElementById(modelName + '_form');
7 | for (const element of form.elements) {
8 | // HTMLElement.offsetParent returns null when the element is not
9 | // rendered.
10 | if (inputTags.includes(element.tagName) && !element.disabled && element.offsetParent) {
11 | element.focus();
12 | break;
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/zh-CN.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(n){return"请删除"+(n.input.length-n.maximum)+"个字符"},inputTooShort:function(n){return"请再输入至少"+(n.minimum-n.input.length)+"个字符"},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(n){return"最多只能选择"+n.maximum+"个项目"},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"},removeAllItems:function(){return"删除所有项目"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ja.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(n){return n.input.length-n.maximum+" 文字を削除してください"},inputTooShort:function(n){return"少なくとも "+(n.minimum-n.input.length)+" 文字を入力してください"},loadingMore:function(){return"読み込み中…"},maximumSelected:function(n){return n.maximum+" 件しか選択できません"},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"},removeAllItems:function(){return"すべてのアイテムを削除"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/az.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/az",[],function(){return{inputTooLong:function(n){return n.input.length-n.maximum+" simvol silin"},inputTooShort:function(n){return n.minimum-n.input.length+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(n){return"Sadəcə "+n.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"},removeAllItems:function(){return"Bütün elementləri sil"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-clock.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ko.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(n){return"너무 깁니다. "+(n.input.length-n.maximum)+" 글자 지워주세요."},inputTooShort:function(n){return"너무 짧습니다. "+(n.minimum-n.input.length)+" 글자 더 입력해주세요."},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(n){return"최대 "+n.maximum+"개까지만 선택 가능합니다."},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"},removeAllItems:function(){return"모든 항목 삭제"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/usersapp/urls.py:
--------------------------------------------------------------------------------
1 | from django.views.generic import DeleteView
2 |
3 | from .views import RegisterView, LoginView, AllUsersView, UserDetailView,UpdatePasswordUser,UpdateData,DeleteUserAPI
4 | from django.urls import path
5 |
6 | urlpatterns = [
7 | path('register/', RegisterView.as_view(), name='register'),
8 | path('login/', LoginView.as_view(), name='login'),
9 | path('allusers/', AllUsersView.as_view(), name='all_users'),
10 | path('users//', UserDetailView.as_view(), name='user_detail'),
11 | path('update_password/', UpdatePasswordUser.as_view(), name='update_password'),
12 | path('update_data/', UpdateData.as_view(), name='update_data'),
13 | path('delete/', DeleteUserAPI.as_view(), name='delete'),
14 | ]
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | """Run administrative tasks."""
9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Core.settings')
10 | try:
11 | from django.core.management import execute_from_command_line
12 | except ImportError as exc:
13 | raise ImportError(
14 | "Couldn't import Django. Are you sure it's installed and "
15 | "available on your PYTHONPATH environment variable? Did you "
16 | "forget to activate a virtual environment?"
17 | ) from exc
18 | execute_from_command_line(sys.argv)
19 |
20 |
21 | if __name__ == '__main__':
22 | main()
23 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/vi.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/vi",[],function(){return{inputTooLong:function(n){return"Vui lòng xóa bớt "+(n.input.length-n.maximum)+" ký tự"},inputTooShort:function(n){return"Vui lòng nhập thêm từ "+(n.minimum-n.input.length)+" ký tự trở lên"},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(n){return"Chỉ có thể chọn được "+n.maximum+" lựa chọn"},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"},removeAllItems:function(){return"Xóa tất cả các mục"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/tk.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){return e.input.length-e.maximum+" harp bozuň."},inputTooShort:function(e){return"Ýene-de iň az "+(e.minimum-e.input.length)+" harp ýazyň."},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){return"Diňe "+e.maximum+" sanysyny saýlaň."},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/uzum.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ -d "venv" ]; then
4 | source venv/bin/activate
5 | echo "Virtual muhit aktivlashtirildi"
6 | fi
7 |
8 | if [ -d "usersapp/migrations" ]; then
9 | rm -rf usersapp/migrations/*
10 | echo "Usersapp migrations tozalandi"
11 | fi
12 |
13 | if [ -d "cardapp/migrations" ]; then
14 | rm -rf cardapp/migrations/*
15 | echo "Cardapp migrations tozalandi"
16 | fi
17 |
18 | touch usersapp/migrations/__init__.py
19 | touch cardapp/migrations/__init__.py
20 | echo "Yangi __init__.py fayllari yaratildi"
21 |
22 | python manage.py collectstatic --noinput
23 |
24 | python manage.py makemigrations usersapp
25 | python manage.py makemigrations cardapp
26 | python manage.py migrate
27 | python manage.py createsuperuser
28 | python manage.py runserver
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/id.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(n){return"Hapuskan "+(n.input.length-n.maximum)+" huruf"},inputTooShort:function(n){return"Masukkan "+(n.minimum-n.input.length)+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(n){return"Anda hanya dapat memilih "+n.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Hapus semua item"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/tr.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(n){return n.input.length-n.maximum+" karakter daha girmelisiniz"},inputTooShort:function(n){return"En az "+(n.minimum-n.input.length)+" karakter daha girmelisiniz"},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(n){return"Sadece "+n.maximum+" seçim yapabilirsiniz"},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"},removeAllItems:function(){return"Tüm öğeleri kaldır"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ar.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(n){return"الرجاء حذف "+(n.input.length-n.maximum)+" عناصر"},inputTooShort:function(n){return"الرجاء إضافة "+(n.minimum-n.input.length)+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(n){return"تستطيع إختيار "+n.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"},removeAllItems:function(){return"قم بإزالة كل العناصر"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/th.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(n){return"โปรดลบออก "+(n.input.length-n.maximum)+" ตัวอักษร"},inputTooShort:function(n){return"โปรดพิมพ์เพิ่มอีก "+(n.minimum-n.input.length)+" ตัวอักษร"},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(n){return"คุณสามารถเลือกได้ไม่เกิน "+n.maximum+" รายการ"},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"},removeAllItems:function(){return"ลบรายการทั้งหมด"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/nb.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){return"Vennligst fjern "+(e.input.length-e.maximum)+" tegn"},inputTooShort:function(e){return"Vennligst skriv inn "+(e.minimum-e.input.length)+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/km.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(n){return"សូមលុបចេញ "+(n.input.length-n.maximum)+" អក្សរ"},inputTooShort:function(n){return"សូមបញ្ចូល"+(n.minimum-n.input.length)+" អក្សរ រឺ ច្រើនជាងនេះ"},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(n){return"អ្នកអាចជ្រើសរើសបានតែ "+n.maximum+" ជម្រើសប៉ុណ្ណោះ"},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."},removeAllItems:function(){return"លុបធាតុទាំងអស់"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/sv.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(n){return"Vänligen sudda ut "+(n.input.length-n.maximum)+" tecken"},inputTooShort:function(n){return"Vänligen skriv in "+(n.minimum-n.input.length)+" eller fler tecken"},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(n){return"Du kan max välja "+n.maximum+" element"},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"},removeAllItems:function(){return"Ta bort alla objekt"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/fi.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(n){return"Ole hyvä ja anna "+(n.input.length-n.maximum)+" merkkiä vähemmän"},inputTooShort:function(n){return"Ole hyvä ja anna "+(n.minimum-n.input.length)+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(n){return"Voit valita ainoastaan "+n.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"},removeAllItems:function(){return"Poista kaikki kohteet"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/is.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/is",[],function(){return{inputTooLong:function(n){var t=n.input.length-n.maximum,e="Vinsamlegast styttið texta um "+t+" staf";return t<=1?e:e+"i"},inputTooShort:function(n){var t=n.minimum-n.input.length,e="Vinsamlegast skrifið "+t+" staf";return t>1&&(e+="i"),e+=" í viðbót"},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(n){return"Þú getur aðeins valið "+n.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"},removeAllItems:function(){return"Fjarlægðu öll atriði"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/et.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var n=e.input.length-e.maximum,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" vähem"},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" rohkem"},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var n="Saad vaid "+e.maximum+" tulemus";return 1==e.maximum?n+="e":n+="t",n+=" valida"},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"},removeAllItems:function(){return"Eemalda kõik esemed"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/hu.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){return"Túl hosszú. "+(e.input.length-e.maximum)+" karakterrel több, mint kellene."},inputTooShort:function(e){return"Túl rövid. Még "+(e.minimum-e.input.length)+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"},removeAllItems:function(){return"Távolítson el minden elemet"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ms.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(n){return"Sila hapuskan "+(n.input.length-n.maximum)+" aksara"},inputTooShort:function(n){return"Sila masukkan "+(n.minimum-n.input.length)+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(n){return"Anda hanya boleh memilih "+n.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Keluarkan semua item"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ka.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ka",[],function(){return{errorLoading:function(){return"მონაცემების ჩატვირთვა შეუძლებელია."},inputTooLong:function(n){return"გთხოვთ აკრიფეთ "+(n.input.length-n.maximum)+" სიმბოლოთი ნაკლები"},inputTooShort:function(n){return"გთხოვთ აკრიფეთ "+(n.minimum-n.input.length)+" სიმბოლო ან მეტი"},loadingMore:function(){return"მონაცემების ჩატვირთვა…"},maximumSelected:function(n){return"თქვენ შეგიძლიათ აირჩიოთ არაუმეტეს "+n.maximum+" ელემენტი"},noResults:function(){return"რეზულტატი არ მოიძებნა"},searching:function(){return"ძიება…"},removeAllItems:function(){return"ამოიღე ყველა ელემენტი"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/bg.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bg",[],function(){return{inputTooLong:function(n){var e=n.input.length-n.maximum,u="Моля въведете с "+e+" по-малко символ";return e>1&&(u+="a"),u},inputTooShort:function(n){var e=n.minimum-n.input.length,u="Моля въведете още "+e+" символ";return e>1&&(u+="a"),u},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(n){var e="Можете да направите до "+n.maximum+" ";return n.maximum>1?e+="избора":e+="избор",e},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"},removeAllItems:function(){return"Премахнете всички елементи"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/da.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){return"Angiv venligst "+(e.input.length-e.maximum)+" tegn mindre"},inputTooShort:function(e){return"Angiv venligst "+(e.minimum-e.input.length)+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var n="Du kan kun vælge "+e.maximum+" emne";return 1!=e.maximum&&(n+="r"),n},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/hy.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(n){return"Խնդրում ենք հեռացնել "+(n.input.length-n.maximum)+" նշան"},inputTooShort:function(n){return"Խնդրում ենք մուտքագրել "+(n.minimum-n.input.length)+" կամ ավել նշաններ"},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(n){return"Դուք կարող եք ընտրել առավելագույնը "+n.maximum+" կետ"},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"},removeAllItems:function(){return"Հեռացնել բոլոր տարրերը"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/fa.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(n){return"لطفاً "+(n.input.length-n.maximum)+" کاراکتر را حذف نمایید"},inputTooShort:function(n){return"لطفاً تعداد "+(n.minimum-n.input.length)+" کاراکتر یا بیشتر وارد نمایید"},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(n){return"شما تنها میتوانید "+n.maximum+" آیتم را انتخاب نمایید"},noResults:function(){return"هیچ نتیجهای یافت نشد"},searching:function(){return"در حال جستجو..."},removeAllItems:function(){return"همه موارد را حذف کنید"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/en.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Please delete "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var n="You can only select "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/hi.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(n){var e=n.input.length-n.maximum,r=e+" अक्षर को हटा दें";return e>1&&(r=e+" अक्षरों को हटा दें "),r},inputTooShort:function(n){return"कृपया "+(n.minimum-n.input.length)+" या अधिक अक्षर दर्ज करें"},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(n){return"आप केवल "+n.maximum+" आइटम का चयन कर सकते हैं"},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."},removeAllItems:function(){return"सभी वस्तुओं को हटा दें"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/he.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="נא למחוק ";return r+=1===e?"תו אחד":e+" תווים"},inputTooShort:function(n){var e=n.minimum-n.input.length,r="נא להכניס ";return r+=1===e?"תו אחד":e+" תווים",r+=" או יותר"},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(n){var e="באפשרותך לבחור עד ";return 1===n.maximum?e+="פריט אחד":e+=n.maximum+" פריטים",e},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"},removeAllItems:function(){return"הסר את כל הפריטים"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/hr.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hr",[],function(){function n(n){var e=" "+n+" znak";return n%10<5&&n%10>0&&(n%100<5||n%100>19)?n%10>1&&(e+="a"):e+="ova",e}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(e){return"Unesite "+n(e.input.length-e.maximum)},inputTooShort:function(e){return"Unesite još "+n(e.minimum-e.input.length)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(n){return"Maksimalan broj odabranih stavki je "+n.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Ukloni sve stavke"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/de.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){return"Bitte "+(e.input.length-e.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(e){return"Bitte "+(e.minimum-e.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var n="Sie können nur "+e.maximum+" Element";return 1!=e.maximum&&(n+="e"),n+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/af.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Verwyders asseblief "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Voer asseblief "+(e.minimum-e.input.length)+" of meer karakters"},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var n="Kies asseblief net "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"},removeAllItems:function(){return"Verwyder alle items"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/eu.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gutxiago"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gehiago"},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return 1===e.maximum?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"},removeAllItems:function(){return"Kendu elementu guztiak"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/mk.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/mk",[],function(){return{inputTooLong:function(n){var e=(n.input.length,n.maximum,"Ве молиме внесете "+n.maximum+" помалку карактер");return 1!==n.maximum&&(e+="и"),e},inputTooShort:function(n){var e=(n.minimum,n.input.length,"Ве молиме внесете уште "+n.maximum+" карактер");return 1!==n.maximum&&(e+="и"),e},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(n){var e="Можете да изберете само "+n.maximum+" ставк";return 1===n.maximum?e+="а":e+="и",e},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"},removeAllItems:function(){return"Отстрани ги сите предмети"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/pt-BR.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Apague "+n+" caracter";return 1!=n&&(r+="es"),r},inputTooShort:function(e){return"Digite "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var n="Você só pode selecionar "+e.maximum+" ite";return 1==e.maximum?n+="m":n+="ns",n},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/pt.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var r=e.input.length-e.maximum,n="Por favor apague "+r+" ";return n+=1!=r?"caracteres":"caractere"},inputTooShort:function(e){return"Introduza "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var r="Apenas pode seleccionar "+e.maximum+" ";return r+=1!=e.maximum?"itens":"item"},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/bn.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bn",[],function(){return{errorLoading:function(){return"ফলাফলগুলি লোড করা যায়নি।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।";return 1!=e&&(u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।"),u},inputTooShort:function(n){return n.minimum-n.input.length+" টি অক্ষর অথবা অধিক অক্ষর লিখুন।"},loadingMore:function(){return"আরো ফলাফল লোড হচ্ছে ..."},maximumSelected:function(n){var e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।";return 1!=n.maximum&&(e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।"),e},noResults:function(){return"কোন ফলাফল পাওয়া যায়নি।"},searching:function(){return"অনুসন্ধান করা হচ্ছে ..."}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/lv.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/lv",[],function(){function e(e,n,u,i){return 11===e?n:e%10==1?u:i}return{inputTooLong:function(n){var u=n.input.length-n.maximum,i="Lūdzu ievadiet par "+u;return(i+=" simbol"+e(u,"iem","u","iem"))+" mazāk"},inputTooShort:function(n){var u=n.minimum-n.input.length,i="Lūdzu ievadiet vēl "+u;return i+=" simbol"+e(u,"us","u","us")},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(n){var u="Jūs varat izvēlēties ne vairāk kā "+n.maximum;return u+=" element"+e(n.maximum,"us","u","us")},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"},removeAllItems:function(){return"Noņemt visus vienumus"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ca.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Si us plau, elimina "+n+" car";return r+=1==n?"àcter":"àcters"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Si us plau, introdueix "+n+" car";return r+=1==n?"àcter":"àcters"},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var n="Només es pot seleccionar "+e.maximum+" element";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"},removeAllItems:function(){return"Treu tots els elements"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ps.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="د مهربانۍ لمخي "+e+" توری ړنګ کړئ";return 1!=e&&(r=r.replace("توری","توري")),r},inputTooShort:function(n){return"لږ تر لږه "+(n.minimum-n.input.length)+" يا ډېر توري وليکئ"},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(n){var e="تاسو يوازي "+n.maximum+" قلم په نښه کولای سی";return 1!=n.maximum&&(e=e.replace("قلم","قلمونه")),e},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."},removeAllItems:function(){return"ټول توکي لرې کړئ"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/sq.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sq",[],function(){return{errorLoading:function(){return"Rezultatet nuk mund të ngarkoheshin."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Të lutem fshi "+n+" karakter";return 1!=n&&(t+="e"),t},inputTooShort:function(e){return"Të lutem shkruaj "+(e.minimum-e.input.length)+" ose më shumë karaktere"},loadingMore:function(){return"Duke ngarkuar më shumë rezultate…"},maximumSelected:function(e){var n="Mund të zgjedhësh vetëm "+e.maximum+" element";return 1!=e.maximum&&(n+="e"),n},noResults:function(){return"Nuk u gjet asnjë rezultat"},searching:function(){return"Duke kërkuar…"},removeAllItems:function(){return"Hiq të gjitha sendet"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/it.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Per favore cancella "+n+" caratter";return t+=1!==n?"i":"e"},inputTooShort:function(e){return"Per favore inserisci "+(e.minimum-e.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var n="Puoi selezionare solo "+e.maximum+" element";return 1!==e.maximum?n+="i":n+="o",n},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/nl.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){return"Gelieve "+(e.input.length-e.maximum)+" karakters te verwijderen"},inputTooShort:function(e){return"Gelieve "+(e.minimum-e.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var n=1==e.maximum?"kan":"kunnen",r="Er "+n+" maar "+e.maximum+" item";return 1!=e.maximum&&(r+="s"),r+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/usersapp/serializers.py:
--------------------------------------------------------------------------------
1 | from rest_framework import serializers
2 | from .models import User
3 |
4 | class UserSerializer(serializers.ModelSerializer):
5 | class Meta:
6 | model = User
7 | fields = ['id', 'first_name', 'last_name', 'birth_year', 'birth_month', 'birth_days','password' ]
8 | extra_kwargs = {
9 | 'password': {'write_only': True} # Parolni faqat yozish mumkin
10 | }
11 |
12 |
13 | class UpdatePasswordSerializer(serializers.Serializer):
14 | first_name = serializers.CharField()
15 | old_password = serializers.CharField()
16 | new_password = serializers.CharField()
17 |
18 |
19 |
20 | class UpdateDataSerializer(serializers.Serializer):
21 | first_name = serializers.CharField()
22 | old_password = serializers.CharField()
23 | new_password = serializers.CharField()
24 | new_first_name = serializers.CharField()
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ne.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ne",[],function(){return{errorLoading:function(){return"नतिजाहरु देखाउन सकिएन।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="कृपया "+e+" अक्षर मेटाउनुहोस्।";return 1!=e&&(u+="कृपया "+e+" अक्षरहरु मेटाउनुहोस्।"),u},inputTooShort:function(n){return"कृपया बाँकी रहेका "+(n.minimum-n.input.length)+" वा अरु धेरै अक्षरहरु भर्नुहोस्।"},loadingMore:function(){return"अरु नतिजाहरु भरिँदैछन् …"},maximumSelected:function(n){var e="तँपाई "+n.maximum+" वस्तु मात्र छान्न पाउँनुहुन्छ।";return 1!=n.maximum&&(e="तँपाई "+n.maximum+" वस्तुहरु मात्र छान्न पाउँनुहुन्छ।"),e},noResults:function(){return"कुनै पनि नतिजा भेटिएन।"},searching:function(){return"खोजि हुँदैछ…"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/fr.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var n=e.input.length-e.maximum;return"Supprimez "+n+" caractère"+(n>1?"s":"")},inputTooShort:function(e){var n=e.minimum-e.input.length;return"Saisissez au moins "+n+" caractère"+(n>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/es.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Por favor, elimine "+n+" car";return r+=1==n?"ácter":"acteres"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Por favor, introduzca "+n+" car";return r+=1==n?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var n="Sólo puede seleccionar "+e.maximum+" elemento";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/gl.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var n=e.input.length-e.maximum;return 1===n?"Elimine un carácter":"Elimine "+n+" caracteres"},inputTooShort:function(e){var n=e.minimum-e.input.length;return 1===n?"Engada un carácter":"Engada "+n+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return 1===e.maximum?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Elimina todos os elementos"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/sl.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Prosim zbrišite "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Prosim vpišite še "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var n="Označite lahko največ "+e.maximum+" predmet";return 2==e.maximum?n+="a":1!=e.maximum&&(n+="e"),n},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"},removeAllItems:function(){return"Odstranite vse elemente"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ro.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return 1!==t&&(n+="e"),n},inputTooShort:function(e){return"Vă rugăm să introduceți "+(e.minimum-e.input.length)+" sau mai multe caractere"},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",1!==e.maximum&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"},removeAllItems:function(){return"Eliminați toate elementele"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/lt.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/lt",[],function(){function n(n,e,i,t){return n%10==1&&(n%100<11||n%100>19)?e:n%10>=2&&n%10<=9&&(n%100<11||n%100>19)?i:t}return{inputTooLong:function(e){var i=e.input.length-e.maximum,t="Pašalinkite "+i+" simbol";return t+=n(i,"į","ius","ių")},inputTooShort:function(e){var i=e.minimum-e.input.length,t="Įrašykite dar "+i+" simbol";return t+=n(i,"į","ius","ių")},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(e){var i="Jūs galite pasirinkti tik "+e.maximum+" element";return i+=n(e.maximum,"ą","us","ų")},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"},removeAllItems:function(){return"Pašalinti visus elementus"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/pl.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pl",[],function(){var n=["znak","znaki","znaków"],e=["element","elementy","elementów"],r=function(n,e){return 1===n?e[0]:n>1&&n<=4?e[1]:n>=5?e[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Usuń "+t+" "+r(t,n)},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Podaj przynajmniej "+t+" "+r(t,n)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(n){return"Możesz zaznaczyć tylko "+n.maximum+" "+r(n.maximum,e)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/el.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(n){var e=n.input.length-n.maximum,u="Παρακαλώ διαγράψτε "+e+" χαρακτήρ";return 1==e&&(u+="α"),1!=e&&(u+="ες"),u},inputTooShort:function(n){return"Παρακαλώ συμπληρώστε "+(n.minimum-n.input.length)+" ή περισσότερους χαρακτήρες"},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(n){var e="Μπορείτε να επιλέξετε μόνο "+n.maximum+" επιλογ";return 1==n.maximum&&(e+="ή"),1!=n.maximum&&(e+="ές"),e},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"},removeAllItems:function(){return"Καταργήστε όλα τα στοιχεία"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/sr.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr",[],function(){function n(n,e,r,t){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(e){var r=e.input.length-e.maximum,t="Obrišite "+r+" simbol";return t+=n(r,"","a","a")},inputTooShort:function(e){var r=e.minimum-e.input.length,t="Ukucajte bar još "+r+" simbol";return t+=n(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(e){var r="Možete izabrati samo "+e.maximum+" stavk";return r+=n(e.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/uk.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/uk",[],function(){function n(n,e,u,r){return n%100>10&&n%100<15?r:n%10==1?e:n%10>1&&n%10<5?u:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(e){return"Будь ласка, видаліть "+(e.input.length-e.maximum)+" "+n(e.maximum,"літеру","літери","літер")},inputTooShort:function(n){return"Будь ласка, введіть "+(n.minimum-n.input.length)+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(e){return"Ви можете вибрати лише "+e.maximum+" "+n(e.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"},removeAllItems:function(){return"Видалити всі елементи"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/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 | }
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/bs.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/bs",[],function(){function e(e,n,r,t){return e%10==1&&e%100!=11?n:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(n){var r=n.input.length-n.maximum,t="Obrišite "+r+" simbol";return t+=e(r,"","a","a")},inputTooShort:function(n){var r=n.minimum-n.input.length,t="Ukucajte bar još "+r+" simbol";return t+=e(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(n){var r="Možete izabrati samo "+n.maximum+" stavk";return r+=e(n.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Uklonite sve stavke"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/sr-Cyrl.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr-Cyrl",[],function(){function n(n,e,r,u){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:u}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Обришите "+r+" симбол";return u+=n(r,"","а","а")},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Укуцајте бар још "+r+" симбол";return u+=n(r,"","а","а")},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(e){var r="Можете изабрати само "+e.maximum+" ставк";return r+=n(e.maximum,"у","е","и")},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/usersapp/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | class User(models.Model):
4 | YEARS = [(str(year), str(year)) for year in range(1990, 2026)]
5 |
6 | # Oylar tanlovi
7 | MONTHS = [
8 | ('1', 'Yanvar'), ('2', 'Fevral'), ('3', 'Mart'), ('4', 'Aprel'),
9 | ('5', 'May'), ('6', 'Iyun'), ('7', 'Iyul'), ('8', 'Avgust'),
10 | ('9', 'Sentabr'), ('10', 'Oktabr'), ('11', 'Noyabr'), ('12', 'Dekabr')
11 | ]
12 |
13 | # Kunlar (1-31)
14 | DAYS = [(str(day), str(day)) for day in range(1, 32)]
15 |
16 | first_name = models.CharField(max_length=16)
17 | last_name = models.CharField(max_length=16)
18 | birth_year = models.CharField(max_length=4,choices=YEARS)
19 | birth_month = models.CharField(max_length=2,choices=MONTHS)
20 | birth_days = models.CharField(max_length=2,choices=DAYS)
21 | password = models.CharField(max_length=255)
22 |
23 |
24 | def __str__(self):
25 | return self.first_name
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/ru.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ru",[],function(){function n(n,e,r,u){return n%10<5&&n%10>0&&n%100<5||n%100>20?n%10>1?r:e:u}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Пожалуйста, введите на "+r+" символ";return u+=n(r,"","a","ов"),u+=" меньше"},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Пожалуйста, введите ещё хотя бы "+r+" символ";return u+=n(r,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(e){var r="Вы можете выбрать не более "+e.maximum+" элемент";return r+=n(e.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/hsb.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hsb",[],function(){var n=["znamješko","znamješce","znamješka","znamješkow"],e=["zapisk","zapiskaj","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Prošu zhašej "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Prošu zapodaj znajmjeńša "+a+" "+u(a,n)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(n){return"Móžeš jenož "+n.maximum+" "+u(n.maximum,e)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/dsb.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/dsb",[],function(){var n=["znamuško","znamušce","znamuška","znamuškow"],e=["zapisk","zapiska","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Pšosym lašuj "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Pšosym zapódaj nanejmjenjej "+a+" "+u(a,n)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(n){return"Móžoš jano "+n.maximum+" "+u(n.maximum,e)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}();
--------------------------------------------------------------------------------
/usersapp/test_users.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from rest_framework.test import APIClient
3 | from rest_framework import status
4 | from usersapp.models import User
5 |
6 | @pytest.fixture
7 | def api_client():
8 | return APIClient()
9 |
10 | @pytest.fixture
11 | def create_user(db):
12 | user = User.objects.create(username="testuser", password="testpass")
13 | return user
14 |
15 | @pytest.mark.django_db
16 | def test_create_user(api_client):
17 | data = {"username": "newuser", "password": "securepass"}
18 | response = api_client.post("/user/register/", data) # ✅ URL yangilandi
19 | assert response.status_code == status.HTTP_201_CREATED
20 | assert User.objects.count() == 1
21 | assert User.objects.first().username == "newuser"
22 |
23 | @pytest.mark.django_db
24 | def test_get_users(api_client, create_user):
25 | response = api_client.get("/user/allusers/") # ✅ URL to‘g‘rilandi
26 | assert response.status_code == status.HTTP_200_OK
27 | assert response.data[0]["username"] == create_user.username
28 |
--------------------------------------------------------------------------------
/cardapp/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 | from usersapp.models import User
3 | from datetime import timedelta, date
4 |
5 |
6 | class Card(models.Model):
7 | card_holder = models.ForeignKey(User, on_delete=models.CASCADE,related_name='cardholder')
8 | # one = models.OneToOneField(User, on_delete=models.CASCADE,related_name='one')
9 | card_number = models.CharField(max_length=16, unique=True)
10 | card_pin_code = models.CharField(max_length=4)
11 | expired_date = models.DateField() # auto_now_add olib tashlandi
12 | money = models.FloatField(default=0)
13 |
14 | def save(self, *args, **kwargs):
15 | if not self.expired_date:
16 | self.expired_date = date.today() + timedelta(days=5 * 365) # 5 yil qo‘shish
17 | super().save(*args, **kwargs)
18 |
19 | @property
20 | def is_expired(self):
21 | return date.today() > self.expired_date # True yoki False qaytaradi
22 |
23 | @property
24 | def is_active(self):
25 | return not self.is_expired # True bo‘lsa, aktiv
26 |
27 |
28 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/filters.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Persist changelist filters state (collapsed/expanded).
3 | */
4 | 'use strict';
5 | {
6 | // Init filters.
7 | let filters = JSON.parse(sessionStorage.getItem('django.admin.filtersState'));
8 |
9 | if (!filters) {
10 | filters = {};
11 | }
12 |
13 | Object.entries(filters).forEach(([key, value]) => {
14 | const detailElement = document.querySelector(`[data-filter-title='${CSS.escape(key)}']`);
15 |
16 | // Check if the filter is present, it could be from other view.
17 | if (detailElement) {
18 | value ? detailElement.setAttribute('open', '') : detailElement.removeAttribute('open');
19 | }
20 | });
21 |
22 | // Save filter state when clicks.
23 | const details = document.querySelectorAll('details');
24 | details.forEach(detail => {
25 | detail.addEventListener('toggle', event => {
26 | filters[`${event.target.dataset.filterTitle}`] = detail.open;
27 | sessionStorage.setItem('django.admin.filtersState', JSON.stringify(filters));
28 | });
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/gis/move_vertex_on.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/icon-calendar.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/img/icon-calendar.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/gis/move_vertex_off.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Core/urls.py:
--------------------------------------------------------------------------------
1 | """
2 | URL configuration for Core project.
3 |
4 | The `urlpatterns` list routes URLs to views. For more information please see:
5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/
6 | Examples:
7 | Function views
8 | 1. Add an import: from my_app import views
9 | 2. Add a URL to urlpatterns: path('', views.home, name='home')
10 | Class-based views
11 | 1. Add an import: from other_app.views import Home
12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
13 | Including another URLconf
14 | 1. Import the include() function: from django.urls import include, path
15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16 | """
17 | from django.contrib import admin
18 | from django.urls import path, include
19 | from django.conf.urls.static import static
20 | from . import settings
21 |
22 | urlpatterns = [
23 | path('admin/', admin.site.urls),
24 | path('user/', include('usersapp.urls')),
25 | path('card/', include('cardapp.urls')),
26 | ] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS[0])
27 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/calendar-icons.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/img/calendar-icons.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Code Charm Ltd
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/sorting-icons.svg:
--------------------------------------------------------------------------------
1 |
20 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright OpenJS Foundation and other contributors, https://openjsf.org/
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/xregexp/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2007-2017 Steven Levithan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/autocomplete.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | {
3 | const $ = django.jQuery;
4 |
5 | $.fn.djangoAdminSelect2 = function() {
6 | $.each(this, function(i, element) {
7 | $(element).select2({
8 | ajax: {
9 | data: (params) => {
10 | return {
11 | term: params.term,
12 | page: params.page,
13 | app_label: element.dataset.appLabel,
14 | model_name: element.dataset.modelName,
15 | field_name: element.dataset.fieldName
16 | };
17 | }
18 | }
19 | });
20 | });
21 | return this;
22 | };
23 |
24 | $(function() {
25 | // Initialize all autocomplete widgets except the one in the template
26 | // form used when a new formset is added.
27 | $('.admin-autocomplete').not('[name*=__prefix__]').djangoAdminSelect2();
28 | });
29 |
30 | document.addEventListener('formset:added', (event) => {
31 | $(event.target).find('.admin-autocomplete').djangoAdminSelect2();
32 | });
33 | }
34 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/cs.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/cs",[],function(){function e(e,n){switch(e){case 2:return n?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadejte o jeden znak méně.":t<=4?"Prosím, zadejte o "+e(t,!0)+" znaky méně.":"Prosím, zadejte o "+t+" znaků méně."},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadejte ještě jeden znak.":t<=4?"Prosím, zadejte ještě další "+e(t,!0)+" znaky.":"Prosím, zadejte ještě dalších "+t+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(n){var t=n.maximum;return 1==t?"Můžete zvolit jen jednu položku.":t<=4?"Můžete zvolit maximálně "+e(t,!1)+" položky.":"Můžete zvolit maximálně "+t+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"},removeAllItems:function(){return"Odstraňte všechny položky"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/admin/css/vendor/select2/LICENSE-SELECT2.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/cardapp/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | from cardapp.models import Card
4 |
5 |
6 | # Register your models here.
7 |
8 |
9 | class CardAdmin(admin.ModelAdmin):
10 | list_display = ('card_holder', 'card_number', 'money', 'view_is_expired', 'view_is_active', 'expired_date')
11 | search_fields = ('card_holder__username', 'card_number')
12 | list_filter = ('expired_date',)
13 | date_hierarchy = 'expired_date'
14 | readonly_fields = ('expired_date',)
15 | empty_value_display = "-empty-"
16 |
17 | fieldsets = (
18 | ('Card info', {
19 | 'fields': ('card_holder', 'card_number')
20 | }),
21 | ('Card security', {
22 | 'fields': ('card_pin_code', 'expired_date')
23 | }),
24 | ('Balance', {
25 | 'fields': ('money',)
26 | })
27 | )
28 |
29 | @admin.display(boolean=True, ordering="expired_date", description="Is Expired?")
30 | def view_is_expired(self, obj):
31 | return obj.is_expired # True/False chiqaradi
32 |
33 | @admin.display(boolean=True, description="Is Active?")
34 | def view_is_active(self, obj):
35 | return obj.is_active # True/False chiqaradi
36 |
37 | admin.site.register(Card, CardAdmin)
38 |
--------------------------------------------------------------------------------
/staticfiles/admin/css/login.css:
--------------------------------------------------------------------------------
1 | /* LOGIN FORM */
2 |
3 | .login {
4 | background: var(--darkened-bg);
5 | height: auto;
6 | }
7 |
8 | .login #header {
9 | height: auto;
10 | padding: 15px 16px;
11 | justify-content: center;
12 | }
13 |
14 | .login #header h1 {
15 | font-size: 1.125rem;
16 | margin: 0;
17 | }
18 |
19 | .login #header h1 a {
20 | color: var(--header-link-color);
21 | }
22 |
23 | .login #content {
24 | padding: 20px 20px 0;
25 | }
26 |
27 | .login #container {
28 | background: var(--body-bg);
29 | border: 1px solid var(--hairline-color);
30 | border-radius: 4px;
31 | overflow: hidden;
32 | width: 28em;
33 | min-width: 300px;
34 | margin: 100px auto;
35 | height: auto;
36 | }
37 |
38 | .login .form-row {
39 | padding: 4px 0;
40 | }
41 |
42 | .login .form-row label {
43 | display: block;
44 | line-height: 2em;
45 | }
46 |
47 | .login .form-row #id_username, .login .form-row #id_password {
48 | padding: 8px;
49 | width: 100%;
50 | box-sizing: border-box;
51 | }
52 |
53 | .login .submit-row {
54 | padding: 1em 0 0 0;
55 | margin: 0;
56 | text-align: center;
57 | }
58 |
59 | .login .password-reset-link {
60 | text-align: center;
61 | }
62 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/vendor/select2/i18n/sk.js:
--------------------------------------------------------------------------------
1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
2 |
3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadajte o jeden znak menej":t>=2&&t<=4?"Prosím, zadajte o "+e[t](!0)+" znaky menej":"Prosím, zadajte o "+t+" znakov menej"},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadajte ešte jeden znak":t<=4?"Prosím, zadajte ešte ďalšie "+e[t](!0)+" znaky":"Prosím, zadajte ešte ďalších "+t+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(n){return 1==n.maximum?"Môžete zvoliť len jednu položku":n.maximum>=2&&n.maximum<=4?"Môžete zvoliť najviac "+e[n.maximum](!1)+" položky":"Môžete zvoliť najviac "+n.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),e.define,e.require}();
--------------------------------------------------------------------------------
/staticfiles/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}
--------------------------------------------------------------------------------
/staticfiles/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 |
--------------------------------------------------------------------------------
/staticfiles/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:not([type=checkbox]), 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 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/prepopulate.js:
--------------------------------------------------------------------------------
1 | /*global URLify*/
2 | 'use strict';
3 | {
4 | const $ = django.jQuery;
5 | $.fn.prepopulate = function(dependencies, maxLength, allowUnicode) {
6 | /*
7 | Depends on urlify.js
8 | Populates a selected field with the values of the dependent fields,
9 | URLifies and shortens the string.
10 | dependencies - array of dependent fields ids
11 | maxLength - maximum length of the URLify'd string
12 | allowUnicode - Unicode support of the URLify'd string
13 | */
14 | return this.each(function() {
15 | const prepopulatedField = $(this);
16 |
17 | const populate = function() {
18 | // Bail if the field's value has been changed by the user
19 | if (prepopulatedField.data('_changed')) {
20 | return;
21 | }
22 |
23 | const values = [];
24 | $.each(dependencies, function(i, field) {
25 | field = $(field);
26 | if (field.val().length > 0) {
27 | values.push(field.val());
28 | }
29 | });
30 | prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode));
31 | };
32 |
33 | prepopulatedField.data('_changed', false);
34 | prepopulatedField.on('change', function() {
35 | prepopulatedField.data('_changed', true);
36 | });
37 |
38 | if (!prepopulatedField.val()) {
39 | $(dependencies.join(',')).on('keyup change focus', populate);
40 | }
41 | });
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/popup_response.js:
--------------------------------------------------------------------------------
1 | (function() {
2 |
3 | 'use strict';
4 |
5 | var windowRef = window;
6 | var windowRefProxy;
7 | var windowName, widgetName;
8 | var openerRef = windowRef.opener;
9 | if (!openerRef) {
10 | // related modal is active
11 | openerRef = windowRef.parent;
12 | windowName = windowRef.name;
13 | widgetName = windowName.replace(/^(change|add|delete|lookup)_/, '');
14 | windowRefProxy = {
15 | name: widgetName,
16 | location: windowRef.location,
17 | close: function() {
18 | openerRef.dismissRelatedObjectModal();
19 | }
20 | };
21 | windowRef = windowRefProxy;
22 | }
23 |
24 | // default django popup_response.js
25 | var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
26 | switch (initData.action) {
27 | case 'change':
28 | if (typeof(openerRef.dismissChangeRelatedObjectPopup) === 'function') {
29 | openerRef.dismissChangeRelatedObjectPopup(windowRef, initData.value, initData.obj, initData.new_value);
30 | }
31 | break;
32 | case 'delete':
33 | if (typeof(openerRef.dismissDeleteRelatedObjectPopup) === 'function') {
34 | openerRef.dismissDeleteRelatedObjectPopup(windowRef, initData.value);
35 | }
36 | break;
37 | default:
38 | if (typeof(openerRef.dismissAddRelatedObjectPopup) === 'function') {
39 | openerRef.dismissAddRelatedObjectPopup(windowRef, initData.value, initData.obj);
40 | }
41 | break;
42 | }
43 |
44 | })();
--------------------------------------------------------------------------------
/staticfiles/admin/js/collapse.js:
--------------------------------------------------------------------------------
1 | /*global gettext*/
2 | 'use strict';
3 | {
4 | window.addEventListener('load', function() {
5 | // Add anchor tag for Show/Hide link
6 | const fieldsets = document.querySelectorAll('fieldset.collapse');
7 | for (const [i, elem] of fieldsets.entries()) {
8 | // Don't hide if fields in this fieldset have errors
9 | if (elem.querySelectorAll('div.errors, ul.errorlist').length === 0) {
10 | elem.classList.add('collapsed');
11 | const h2 = elem.querySelector('h2');
12 | const link = document.createElement('a');
13 | link.id = 'fieldsetcollapser' + i;
14 | link.className = 'collapse-toggle';
15 | link.href = '#';
16 | link.textContent = gettext('Show');
17 | h2.appendChild(document.createTextNode(' ('));
18 | h2.appendChild(link);
19 | h2.appendChild(document.createTextNode(')'));
20 | }
21 | }
22 | // Add toggle to hide/show anchor tag
23 | const toggleFunc = function(ev) {
24 | if (ev.target.matches('.collapse-toggle')) {
25 | ev.preventDefault();
26 | ev.stopPropagation();
27 | const fieldset = ev.target.closest('fieldset');
28 | if (fieldset.classList.contains('collapsed')) {
29 | // Show
30 | ev.target.textContent = gettext('Hide');
31 | fieldset.classList.remove('collapsed');
32 | } else {
33 | // Hide
34 | ev.target.textContent = gettext('Show');
35 | fieldset.classList.add('collapsed');
36 | }
37 | }
38 | };
39 | document.querySelectorAll('fieldset.module').forEach(function(el) {
40 | el.addEventListener('click', toggleFunc);
41 | });
42 | });
43 | }
44 |
--------------------------------------------------------------------------------
/cardapp/serializers.py:
--------------------------------------------------------------------------------
1 | from rest_framework import serializers
2 | from .models import Card
3 | from usersapp.models import User
4 |
5 |
6 | class CardSerializer(serializers.ModelSerializer):
7 | class Meta:
8 | model = Card
9 | fields = "__all__"
10 |
11 |
12 |
13 | class TransacsionSerializer(serializers.Serializer):
14 | user_id = serializers.IntegerField()
15 | sender_card = serializers.CharField(max_length=16)
16 | reciver_card= serializers.CharField(max_length=16)
17 | money = serializers.FloatField()
18 |
19 |
20 |
21 | class UpdatePasswordCardSerializer(serializers.Serializer):
22 | card_number = serializers.CharField(max_length=16)
23 | old_card_pin_code = serializers.CharField()
24 | new_card_pin_code = serializers.CharField()
25 |
26 |
27 | # class UpdateDataCardSerializer(serializers.Serializer):
28 | # old_card_number = serializers.CharField(max_length=16)
29 | # new_card_number = serializers.CharField(max_length=16)
30 | # old_card_pin_code = serializers.CharField()
31 | # new_card_pin_code = serializers.CharField()
32 |
33 |
34 | class UpdateDataCardSerializer(serializers.ModelSerializer):
35 | class Meta:
36 | model = Card
37 | fields = ['card_pin_code', 'money'] # Faqat o‘zgartirilishi mumkin bo‘lgan maydonlar
38 | extra_kwargs = {
39 | 'card_pin_code': {'required': False}, # Majburiy emas
40 | 'money': {'required': False}, # Majburiy emas
41 | }
42 |
43 | def validate_money(self, value):
44 | if value < 0:
45 | raise serializers.ValidationError("Money amount cannot be negative")
46 | return value
47 |
48 | class AddMoneySerializer(serializers.Serializer):
49 | card_number = serializers.CharField(max_length=16)
50 | money = serializers.FloatField()
51 |
52 |
53 |
54 |
55 | class AddCardSerializer(serializers.ModelSerializer):
56 | class Meta:
57 | model = Card
58 | fields = "__all__"
59 |
60 |
--------------------------------------------------------------------------------
/staticfiles/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 | window.drf = JSON.parse(document.getElementById('drf_csrf').textContent);
42 | var csrftoken = window.drf.csrfToken;
43 |
44 | $.ajaxSetup({
45 | beforeSend: function(xhr, settings) {
46 | if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {
47 | // Send the token to same-origin, relative URLs only.
48 | // Send the token only if the method warrants CSRF protection
49 | // Using the CSRFToken value acquired earlier
50 | xhr.setRequestHeader(window.drf.csrfHeaderName, csrftoken);
51 | }
52 | }
53 | });
54 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/theme.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | {
3 | window.addEventListener('load', function(e) {
4 |
5 | function setTheme(mode) {
6 | if (mode !== "light" && mode !== "dark" && mode !== "auto") {
7 | console.error(`Got invalid theme mode: ${mode}. Resetting to auto.`);
8 | mode = "auto";
9 | }
10 | document.documentElement.dataset.theme = mode;
11 | localStorage.setItem("theme", mode);
12 | }
13 |
14 | function cycleTheme() {
15 | const currentTheme = localStorage.getItem("theme") || "auto";
16 | const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
17 |
18 | if (prefersDark) {
19 | // Auto (dark) -> Light -> Dark
20 | if (currentTheme === "auto") {
21 | setTheme("light");
22 | } else if (currentTheme === "light") {
23 | setTheme("dark");
24 | } else {
25 | setTheme("auto");
26 | }
27 | } else {
28 | // Auto (light) -> Dark -> Light
29 | if (currentTheme === "auto") {
30 | setTheme("dark");
31 | } else if (currentTheme === "dark") {
32 | setTheme("light");
33 | } else {
34 | setTheme("auto");
35 | }
36 | }
37 | }
38 |
39 | function initTheme() {
40 | // set theme defined in localStorage if there is one, or fallback to auto mode
41 | const currentTheme = localStorage.getItem("theme");
42 | currentTheme ? setTheme(currentTheme) : setTheme("auto");
43 | }
44 |
45 | function setupTheme() {
46 | // Attach event handlers for toggling themes
47 | const buttons = document.getElementsByClassName("theme-toggle");
48 | Array.from(buttons).forEach((btn) => {
49 | btn.addEventListener("click", cycleTheme);
50 | });
51 | initTheme();
52 | }
53 |
54 | setupTheme();
55 | });
56 | }
57 |
--------------------------------------------------------------------------------
/staticfiles/admin/css/responsive_rtl.css:
--------------------------------------------------------------------------------
1 | /* TABLETS */
2 |
3 | @media (max-width: 1024px) {
4 | [dir="rtl"] .colMS {
5 | margin-right: 0;
6 | }
7 |
8 | [dir="rtl"] #user-tools {
9 | text-align: right;
10 | }
11 |
12 | [dir="rtl"] #changelist .actions label {
13 | padding-left: 10px;
14 | padding-right: 0;
15 | }
16 |
17 | [dir="rtl"] #changelist .actions select {
18 | margin-left: 0;
19 | margin-right: 15px;
20 | }
21 |
22 | [dir="rtl"] .change-list .filtered .results,
23 | [dir="rtl"] .change-list .filtered .paginator,
24 | [dir="rtl"] .filtered #toolbar,
25 | [dir="rtl"] .filtered div.xfull,
26 | [dir="rtl"] .filtered .actions,
27 | [dir="rtl"] #changelist-filter {
28 | margin-left: 0;
29 | }
30 |
31 | [dir="rtl"] .inline-group ul.tools a.add,
32 | [dir="rtl"] .inline-group div.add-row a,
33 | [dir="rtl"] .inline-group .tabular tr.add-row td a {
34 | padding: 8px 26px 8px 10px;
35 | background-position: calc(100% - 8px) 9px;
36 | }
37 |
38 | [dir="rtl"] .related-widget-wrapper-link + .selector {
39 | margin-right: 0;
40 | margin-left: 15px;
41 | }
42 |
43 | [dir="rtl"] .selector .selector-filter label {
44 | margin-right: 0;
45 | margin-left: 8px;
46 | }
47 |
48 | [dir="rtl"] .object-tools li {
49 | float: right;
50 | }
51 |
52 | [dir="rtl"] .object-tools li + li {
53 | margin-left: 0;
54 | margin-right: 15px;
55 | }
56 |
57 | [dir="rtl"] .dashboard .module table td a {
58 | padding-left: 0;
59 | padding-right: 16px;
60 | }
61 | }
62 |
63 | /* MOBILE */
64 |
65 | @media (max-width: 767px) {
66 | [dir="rtl"] .aligned .related-lookup,
67 | [dir="rtl"] .aligned .datetimeshortcuts {
68 | margin-left: 0;
69 | margin-right: 15px;
70 | }
71 |
72 | [dir="rtl"] .aligned ul,
73 | [dir="rtl"] form .aligned ul.errorlist {
74 | margin-right: 0;
75 | }
76 |
77 | [dir="rtl"] #changelist-filter {
78 | margin-left: 0;
79 | margin-right: 0;
80 | }
81 | [dir="rtl"] .aligned .vCheckboxLabel {
82 | padding: 1px 5px 0 0;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/staticfiles/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 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/js/change_list.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | 'use strict';
3 |
4 | $.fn.search_filters = function () {
5 | $(this).change(function () {
6 | const $field = $(this);
7 | const $option = $field.find('option:selected');
8 | const select_name = $option.data('name');
9 | if (select_name) {
10 | $field.attr('name', select_name);
11 | } else {
12 | $field.removeAttr('name');
13 | }
14 | });
15 | $(this).trigger('change');
16 | };
17 |
18 | function getMinimuInputLength(element) {
19 | return window.filterInputLength[element.data('name')] ?? window.filterInputLengthDefault;
20 | }
21 |
22 | function searchFilters() {
23 | // Make search filters select2 and ensure they work for filtering
24 | const $ele = $('.search-filter');
25 | $ele.search_filters();
26 | $ele.each(function () {
27 | const $this = $(this);
28 | $this.select2({ width: '100%', minimumInputLength: getMinimuInputLength($this) });
29 | });
30 |
31 | // Use select2 for mptt dropdowns
32 | const $mptt = $('.search-filter-mptt');
33 | if ($mptt.length) {
34 | $mptt.search_filters();
35 | $mptt.select2({
36 | width: '100%',
37 | minimumInputLength: getMinimuInputLength($mptt),
38 | templateResult: function (data) {
39 | // https://stackoverflow.com/questions/30820215/selectable-optgroups-in-select2#30948247
40 | // rewrite templateresult for build tree hierarchy
41 | if (!data.element) {
42 | return data.text;
43 | }
44 | const $element = $(data.element);
45 | let $wrapper = $('');
46 | $wrapper.attr('style', $($element[0]).attr('style'));
47 | $wrapper.text(data.text);
48 | return $wrapper;
49 | },
50 | });
51 | }
52 | }
53 |
54 | $(document).ready(function () {
55 | // Ensure all raw_id_fields have the search icon in them
56 | $('.related-lookup').append('')
57 |
58 | // Allow for styling of selects
59 | $('.actions select').addClass('form-control').select2({ width: 'element' });
60 |
61 | searchFilters();
62 | });
63 |
64 | })(jQuery);
65 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 |
7 | *.so
8 | usersapp/migrations
9 | cardapp/migrations
10 | db.sqlite3
11 | # Distribution / packaging
12 | .Python
13 | build/
14 | develop-eggs/
15 | dist/
16 | downloads/
17 | eggs/
18 | .eggs/
19 | lib/
20 | lib64/
21 | parts/
22 | sdist/
23 | var/
24 | wheels/
25 | pip-wheel-metadata/
26 | share/python-wheels/
27 | *.egg-info/
28 | .installed.cfg
29 | *.egg
30 | MANIFEST
31 |
32 | # PyInstaller
33 | # Usually these files are written by a python script from a template
34 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
35 | *.manifest
36 | *.spec
37 |
38 | # Installer logs
39 | pip-log.txt
40 | pip-delete-this-directory.txt
41 |
42 | # Unit test / coverage reports
43 | htmlcov/
44 | .tox/
45 | .nox/
46 | .coverage
47 | .coverage.*
48 | .cache
49 | nosetests.xml
50 | coverage.xml
51 | *.cover
52 | *.py,cover
53 | .hypothesis/
54 | .pytest_cache/
55 |
56 | # Translations
57 | *.mo
58 | *.pot
59 |
60 | # Django stuff:
61 | *.log
62 | local_settings.py
63 |
64 | db.sqlite3-journal
65 |
66 | # Flask stuff:
67 | instance/
68 | .webassets-cache
69 |
70 | # Scrapy stuff:
71 | .scrapy
72 |
73 | # Sphinx documentation
74 | docs/_build/
75 |
76 | # PyBuilder
77 | target/
78 |
79 | # Jupyter Notebook
80 | .ipynb_checkpoints
81 |
82 | # IPython
83 | profile_default/
84 | ipython_config.py
85 |
86 | # pyenv
87 | .python-version
88 |
89 | # pipenv
90 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
91 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
92 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
93 | # install all needed dependencies.
94 | #Pipfile.lock
95 |
96 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
97 | __pypackages__/
98 |
99 | # Celery stuff
100 | celerybeat-schedule
101 | celerybeat.pid
102 |
103 | # SageMath parsed files
104 | *.sage.py
105 |
106 | # Environments
107 | .venv
108 | */.env
109 | env/
110 | venv/
111 | ENV/
112 | env.bak/
113 | venv.bak/
114 |
115 | # Spyder project settings
116 | .spyderproject
117 | .spyproject
118 |
119 | # Rope project settings
120 | .ropeproject
121 |
122 | # mkdocs documentation
123 | /site
124 |
125 | # mypy
126 | .mypy_cache/
127 | .dmypy.json
128 | dmypy.json
129 |
130 | # Pyre type checker
131 | .pyre/
132 | .idea/*
133 | .env
--------------------------------------------------------------------------------
/staticfiles/jazzmin/js/main.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | 'use strict';
3 |
4 | function setCookie(key, value) {
5 | const expires = new Date();
6 | expires.setTime(expires.getTime() + (value * 24 * 60 * 60 * 1000));
7 | document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + '; SameSite=Strict;path=/';
8 | }
9 |
10 | function getCookie(key) {
11 | const keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
12 | return keyValue ? keyValue[2] : null;
13 | }
14 |
15 | function handleMenu() {
16 | $('[data-widget=pushmenu]').bind('click', function () {
17 | const menuClosed = getCookie('jazzy_menu') === 'closed';
18 | if (!menuClosed) {
19 | setCookie('jazzy_menu', 'closed');
20 | } else {
21 | setCookie('jazzy_menu', 'open');
22 | }
23 | });
24 | }
25 |
26 |
27 | function setActiveLinks() {
28 | /*
29 | Set the currently active menu item based on the current url, or failing that, find the parent
30 | item from the breadcrumbs
31 | */
32 | const url = window.location.pathname;
33 | const $breadcrumb = $('.breadcrumb a').last();
34 | const $link = $('a[href="' + url + '"]');
35 | const $parent_link = $('a[href="' + $breadcrumb.attr('href') + '"]');
36 |
37 | if ($link.length) {
38 | $link.addClass('active');
39 | } else if ($parent_link.length) {
40 | $parent_link.addClass('active');
41 | };
42 |
43 | const $a_active = $('a.nav-link.active');
44 | const $main_li_parent = $a_active.closest('li.nav-item.has-treeview');
45 | const $ul_child = $main_li_parent.children('ul');
46 |
47 | $ul_child.show();
48 | $main_li_parent.addClass('menu-is-opening menu-open');
49 | };
50 |
51 | $(document).ready(function () {
52 | // Set active status on links
53 | setActiveLinks()
54 |
55 | // When we use the menu, store its state in a cookie to preserve it
56 | handleMenu();
57 |
58 | // Add minimal changelist styling to templates that we have been unable to override (e.g MPTT)
59 | // Needs to be here and not in change_list.js because this is the only JS we are guaranteed to run
60 | // (as its included in base.html)
61 | const $changeListTable = $('#changelist .results table');
62 | if ($changeListTable.length && !$changeListTable.hasClass('table table-striped')) {
63 | $changeListTable.addClass('table table-striped');
64 | };
65 | });
66 |
67 | })(jQuery);
68 |
--------------------------------------------------------------------------------
/staticfiles/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);
--------------------------------------------------------------------------------
/staticfiles/jazzmin/plugins/bootstrap-show-modal/bootstrap-show-modal.min.js:
--------------------------------------------------------------------------------
1 | !function(o){"use strict";var s=0;function i(t){for(var e in this.props={title:"",body:"",footer:"",modalClass:"fade",modalDialogClass:"",options:null,onCreate:null,onDispose:null,onSubmit:null},t)this.props[e]=t[e];this.id="bootstrap-show-modal-"+s,s++,this.show()}i.prototype.createContainerElement=function(){var t=this;this.element=document.createElement("div"),this.element.id=this.id,this.element.setAttribute("class","modal "+this.props.modalClass),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.element.setAttribute("aria-labelledby",this.id),this.element.innerHTML='',document.body.appendChild(this.element),this.titleElement=this.element.querySelector(".modal-title"),this.bodyElement=this.element.querySelector(".modal-body"),this.footerElement=this.element.querySelector(".modal-footer"),o(this.element).on("hidden.bs.modal",function(){t.dispose()}),this.props.onCreate&&this.props.onCreate(this)},i.prototype.show=function(){this.element?o(this.element).modal("show"):(this.createContainerElement(),this.props.options?o(this.element).modal(this.props.options):o(this.element).modal()),this.props.title?(o(this.titleElement).show(),this.titleElement.innerHTML=this.props.title):o(this.titleElement).hide(),this.props.body?(o(this.bodyElement).show(),this.bodyElement.innerHTML=this.props.body):o(this.bodyElement).hide(),this.props.footer?(o(this.footerElement).show(),this.footerElement.innerHTML=this.props.footer):o(this.footerElement).hide()},i.prototype.hide=function(){o(this.element).modal("hide")},i.prototype.dispose=function(){o(this.element).modal("dispose"),document.body.removeChild(this.element),this.props.onDispose&&this.props.onDispose(this)},o.extend({showModal:function(t){if(t.buttons){var e,o="";for(e in t.buttons){o+='"}t.footer=o}return new i(t)},showAlert:function(t){return t.buttons={OK:"OK"},this.showModal(t)},showConfirm:function(t){return t.footer='",t.onCreate=function(e){o(e.element).on("click",".btn",function(t){t.preventDefault(),e.hide(),e.props.onSubmit(-1!==t.target.getAttribute("class").indexOf("btn-true"),e)})},this.showModal(t)}})}(jQuery);
2 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/nav_sidebar.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | {
3 | const toggleNavSidebar = document.getElementById('toggle-nav-sidebar');
4 | if (toggleNavSidebar !== null) {
5 | const navSidebar = document.getElementById('nav-sidebar');
6 | const main = document.getElementById('main');
7 | let navSidebarIsOpen = localStorage.getItem('django.admin.navSidebarIsOpen');
8 | if (navSidebarIsOpen === null) {
9 | navSidebarIsOpen = 'true';
10 | }
11 | main.classList.toggle('shifted', navSidebarIsOpen === 'true');
12 | navSidebar.setAttribute('aria-expanded', navSidebarIsOpen);
13 |
14 | toggleNavSidebar.addEventListener('click', function() {
15 | if (navSidebarIsOpen === 'true') {
16 | navSidebarIsOpen = 'false';
17 | } else {
18 | navSidebarIsOpen = 'true';
19 | }
20 | localStorage.setItem('django.admin.navSidebarIsOpen', navSidebarIsOpen);
21 | main.classList.toggle('shifted');
22 | navSidebar.setAttribute('aria-expanded', navSidebarIsOpen);
23 | });
24 | }
25 |
26 | function initSidebarQuickFilter() {
27 | const options = [];
28 | const navSidebar = document.getElementById('nav-sidebar');
29 | if (!navSidebar) {
30 | return;
31 | }
32 | navSidebar.querySelectorAll('th[scope=row] a').forEach((container) => {
33 | options.push({title: container.innerHTML, node: container});
34 | });
35 |
36 | function checkValue(event) {
37 | let filterValue = event.target.value;
38 | if (filterValue) {
39 | filterValue = filterValue.toLowerCase();
40 | }
41 | if (event.key === 'Escape') {
42 | filterValue = '';
43 | event.target.value = ''; // clear input
44 | }
45 | let matches = false;
46 | for (const o of options) {
47 | let displayValue = '';
48 | if (filterValue) {
49 | if (o.title.toLowerCase().indexOf(filterValue) === -1) {
50 | displayValue = 'none';
51 | } else {
52 | matches = true;
53 | }
54 | }
55 | // show/hide parent
56 | o.node.parentNode.parentNode.style.display = displayValue;
57 | }
58 | if (!filterValue || matches) {
59 | event.target.classList.remove('no-results');
60 | } else {
61 | event.target.classList.add('no-results');
62 | }
63 | sessionStorage.setItem('django.admin.navSidebarFilterValue', filterValue);
64 | }
65 |
66 | const nav = document.getElementById('nav-filter');
67 | nav.addEventListener('change', checkValue, false);
68 | nav.addEventListener('input', checkValue, false);
69 | nav.addEventListener('keyup', checkValue, false);
70 |
71 | const storedValue = sessionStorage.getItem('django.admin.navSidebarFilterValue');
72 | if (storedValue) {
73 | nav.value = storedValue;
74 | checkValue({target: nav, key: ''});
75 | }
76 | }
77 | window.initSidebarQuickFilter = initSidebarQuickFilter;
78 | initSidebarQuickFilter();
79 | }
80 |
--------------------------------------------------------------------------------
/staticfiles/admin/img/selector-icons.svg:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/img/selector-icons.svg:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/staticfiles/admin/css/nav_sidebar.css:
--------------------------------------------------------------------------------
1 | .sticky {
2 | position: sticky;
3 | top: 0;
4 | max-height: 100vh;
5 | }
6 |
7 | .toggle-nav-sidebar {
8 | z-index: 20;
9 | left: 0;
10 | display: flex;
11 | align-items: center;
12 | justify-content: center;
13 | flex: 0 0 23px;
14 | width: 23px;
15 | border: 0;
16 | border-right: 1px solid var(--hairline-color);
17 | background-color: var(--body-bg);
18 | cursor: pointer;
19 | font-size: 1.25rem;
20 | color: var(--link-fg);
21 | padding: 0;
22 | }
23 |
24 | [dir="rtl"] .toggle-nav-sidebar {
25 | border-left: 1px solid var(--hairline-color);
26 | border-right: 0;
27 | }
28 |
29 | .toggle-nav-sidebar:hover,
30 | .toggle-nav-sidebar:focus {
31 | background-color: var(--darkened-bg);
32 | }
33 |
34 | #nav-sidebar {
35 | z-index: 15;
36 | flex: 0 0 275px;
37 | left: -276px;
38 | margin-left: -276px;
39 | border-top: 1px solid transparent;
40 | border-right: 1px solid var(--hairline-color);
41 | background-color: var(--body-bg);
42 | overflow: auto;
43 | }
44 |
45 | [dir="rtl"] #nav-sidebar {
46 | border-left: 1px solid var(--hairline-color);
47 | border-right: 0;
48 | left: 0;
49 | margin-left: 0;
50 | right: -276px;
51 | margin-right: -276px;
52 | }
53 |
54 | .toggle-nav-sidebar::before {
55 | content: '\00BB';
56 | }
57 |
58 | .main.shifted .toggle-nav-sidebar::before {
59 | content: '\00AB';
60 | }
61 |
62 | .main > #nav-sidebar {
63 | visibility: hidden;
64 | }
65 |
66 | .main.shifted > #nav-sidebar {
67 | margin-left: 0;
68 | visibility: visible;
69 | }
70 |
71 | [dir="rtl"] .main.shifted > #nav-sidebar {
72 | margin-right: 0;
73 | }
74 |
75 | #nav-sidebar .module th {
76 | width: 100%;
77 | overflow-wrap: anywhere;
78 | }
79 |
80 | #nav-sidebar .module th,
81 | #nav-sidebar .module caption {
82 | padding-left: 16px;
83 | }
84 |
85 | #nav-sidebar .module td {
86 | white-space: nowrap;
87 | }
88 |
89 | [dir="rtl"] #nav-sidebar .module th,
90 | [dir="rtl"] #nav-sidebar .module caption {
91 | padding-left: 8px;
92 | padding-right: 16px;
93 | }
94 |
95 | #nav-sidebar .current-app .section:link,
96 | #nav-sidebar .current-app .section:visited {
97 | color: var(--header-color);
98 | font-weight: bold;
99 | }
100 |
101 | #nav-sidebar .current-model {
102 | background: var(--selected-row);
103 | }
104 |
105 | .main > #nav-sidebar + .content {
106 | max-width: calc(100% - 23px);
107 | }
108 |
109 | .main.shifted > #nav-sidebar + .content {
110 | max-width: calc(100% - 299px);
111 | }
112 |
113 | @media (max-width: 767px) {
114 | #nav-sidebar, #toggle-nav-sidebar {
115 | display: none;
116 | }
117 |
118 | .main > #nav-sidebar + .content,
119 | .main.shifted > #nav-sidebar + .content {
120 | max-width: 100%;
121 | }
122 | }
123 |
124 | #nav-filter {
125 | width: 100%;
126 | box-sizing: border-box;
127 | padding: 2px 5px;
128 | margin: 5px 0;
129 | border: 1px solid var(--border-color);
130 | background-color: var(--darkened-bg);
131 | color: var(--body-fg);
132 | }
133 |
134 | #nav-filter:focus {
135 | border-color: var(--body-quiet-color);
136 | }
137 |
138 | #nav-filter.no-results {
139 | background: var(--message-error-bg);
140 | }
141 |
142 | #nav-sidebar table {
143 | width: 100%;
144 | }
145 |
--------------------------------------------------------------------------------
/staticfiles/admin/css/dark_mode.css:
--------------------------------------------------------------------------------
1 | @media (prefers-color-scheme: dark) {
2 | :root {
3 | --primary: #264b5d;
4 | --primary-fg: #f7f7f7;
5 |
6 | --body-fg: #eeeeee;
7 | --body-bg: #121212;
8 | --body-quiet-color: #e0e0e0;
9 | --body-loud-color: #ffffff;
10 |
11 | --breadcrumbs-link-fg: #e0e0e0;
12 | --breadcrumbs-bg: var(--primary);
13 |
14 | --link-fg: #81d4fa;
15 | --link-hover-color: #4ac1f7;
16 | --link-selected-fg: #6f94c6;
17 |
18 | --hairline-color: #272727;
19 | --border-color: #353535;
20 |
21 | --error-fg: #e35f5f;
22 | --message-success-bg: #006b1b;
23 | --message-warning-bg: #583305;
24 | --message-error-bg: #570808;
25 |
26 | --darkened-bg: #212121;
27 | --selected-bg: #1b1b1b;
28 | --selected-row: #00363a;
29 |
30 | --close-button-bg: #333333;
31 | --close-button-hover-bg: #666666;
32 | }
33 | }
34 |
35 |
36 | html[data-theme="dark"] {
37 | --primary: #264b5d;
38 | --primary-fg: #f7f7f7;
39 |
40 | --body-fg: #eeeeee;
41 | --body-bg: #121212;
42 | --body-quiet-color: #e0e0e0;
43 | --body-loud-color: #ffffff;
44 |
45 | --breadcrumbs-link-fg: #e0e0e0;
46 | --breadcrumbs-bg: var(--primary);
47 |
48 | --link-fg: #81d4fa;
49 | --link-hover-color: #4ac1f7;
50 | --link-selected-fg: #6f94c6;
51 |
52 | --hairline-color: #272727;
53 | --border-color: #353535;
54 |
55 | --error-fg: #e35f5f;
56 | --message-success-bg: #006b1b;
57 | --message-warning-bg: #583305;
58 | --message-error-bg: #570808;
59 |
60 | --darkened-bg: #212121;
61 | --selected-bg: #1b1b1b;
62 | --selected-row: #00363a;
63 |
64 | --close-button-bg: #333333;
65 | --close-button-hover-bg: #666666;
66 | }
67 |
68 | /* THEME SWITCH */
69 | .theme-toggle {
70 | cursor: pointer;
71 | border: none;
72 | padding: 0;
73 | background: transparent;
74 | vertical-align: middle;
75 | margin-inline-start: 5px;
76 | margin-top: -1px;
77 | }
78 |
79 | .theme-toggle svg {
80 | vertical-align: middle;
81 | height: 1rem;
82 | width: 1rem;
83 | display: none;
84 | }
85 |
86 | /*
87 | Fully hide screen reader text so we only show the one matching the current
88 | theme.
89 | */
90 | .theme-toggle .visually-hidden {
91 | display: none;
92 | }
93 |
94 | html[data-theme="auto"] .theme-toggle .theme-label-when-auto {
95 | display: block;
96 | }
97 |
98 | html[data-theme="dark"] .theme-toggle .theme-label-when-dark {
99 | display: block;
100 | }
101 |
102 | html[data-theme="light"] .theme-toggle .theme-label-when-light {
103 | display: block;
104 | }
105 |
106 | /* ICONS */
107 | .theme-toggle svg.theme-icon-when-auto,
108 | .theme-toggle svg.theme-icon-when-dark,
109 | .theme-toggle svg.theme-icon-when-light {
110 | fill: var(--header-link-color);
111 | color: var(--header-bg);
112 | }
113 |
114 | html[data-theme="auto"] .theme-toggle svg.theme-icon-when-auto {
115 | display: block;
116 | }
117 |
118 | html[data-theme="dark"] .theme-toggle svg.theme-icon-when-dark {
119 | display: block;
120 | }
121 |
122 | html[data-theme="light"] .theme-toggle svg.theme-icon-when-light {
123 | display: block;
124 | }
125 |
126 | .visually-hidden {
127 | position: absolute;
128 | width: 1px;
129 | height: 1px;
130 | padding: 0;
131 | overflow: hidden;
132 | clip: rect(0,0,0,0);
133 | white-space: nowrap;
134 | border: 0;
135 | color: var(--body-fg);
136 | background-color: var(--body-bg);
137 | }
138 |
--------------------------------------------------------------------------------
/Core/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for Core project.
3 |
4 | Generated by 'django-admin startproject' using Django 4.2.17.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/4.2/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/4.2/ref/settings/
11 | """
12 |
13 | from pathlib import Path
14 | import os
15 |
16 | # Base directory
17 | BASE_DIR = Path(__file__).resolve().parent.parent
18 |
19 | # Static files configuration
20 |
21 |
22 | # Secret key (replace with your own secret in production)
23 | SECRET_KEY = 'django-insecure-eyql2b8mecy1hwudwwbhzhl3h^dqd0dzhxftvnnz_u^)6$*ceb'
24 |
25 | # Debug mode
26 | DEBUG = True
27 |
28 | # Allowed hosts
29 | ALLOWED_HOSTS = ["*"]
30 |
31 | # Installed apps
32 | INSTALLED_APPS = [
33 | 'jazzmin', # Ensure Jazzmin is installed before Django's default apps
34 | 'django.contrib.admin',
35 | 'django.contrib.auth',
36 | 'django.contrib.contenttypes',
37 | 'django.contrib.sessions',
38 | 'django.contrib.messages',
39 | 'whitenoise.runserver_nostatic',
40 | 'django.contrib.staticfiles',
41 | 'usersapp', # Your custom app, e.g., UzumUser
42 | 'cardapp',
43 | 'rest_framework',
44 | 'sslserver',
45 | ]
46 |
47 | # Middleware
48 | MIDDLEWARE = [
49 |
50 | 'django.middleware.security.SecurityMiddleware',
51 | 'whitenoise.middleware.WhiteNoiseMiddleware',
52 | 'django.contrib.sessions.middleware.SessionMiddleware',
53 | 'django.middleware.common.CommonMiddleware',
54 | 'django.middleware.csrf.CsrfViewMiddleware',
55 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 | 'django.contrib.messages.middleware.MessageMiddleware',
57 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58 | ]
59 |
60 | # URL configuration
61 | ROOT_URLCONF = 'Core.urls'
62 |
63 | # Templates configuration
64 | TEMPLATES = [
65 | {
66 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
67 | 'DIRS': [],
68 | 'APP_DIRS': True,
69 | 'OPTIONS': {
70 | 'context_processors': [
71 | 'django.template.context_processors.debug',
72 | 'django.template.context_processors.request',
73 | 'django.contrib.auth.context_processors.auth',
74 | 'django.contrib.messages.context_processors.messages',
75 | ],
76 | },
77 | },
78 | ]
79 |
80 | # WSGI application
81 | WSGI_APPLICATION = 'Core.wsgi.application'
82 |
83 | # Database
84 | DATABASES = {
85 | 'default': {
86 | 'ENGINE': 'django.db.backends.sqlite3',
87 | 'NAME': BASE_DIR / 'db.sqlite3', # SQLite for simplicity in development
88 | }
89 | }
90 |
91 | # Password validation
92 | AUTH_PASSWORD_VALIDATORS = [
93 | {
94 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
95 | },
96 | {
97 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
98 | },
99 | {
100 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
101 | },
102 | {
103 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
104 | },
105 | ]
106 |
107 | # Internationalization
108 | LANGUAGE_CODE = 'en-us'
109 | TIME_ZONE = 'UTC'
110 | USE_I18N = True
111 | USE_TZ = True
112 |
113 | # Default primary key field type
114 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
115 |
116 | REST_FRAMEWORK = {
117 | 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
118 | 'PAGE_SIZE': 5
119 | }
120 |
121 | # Jazzmin settings = '/static/'
122 | # URL for serving static files
123 | STATIC_URL = '/static/'
124 |
125 | # Directory where Django will collect static files for production
126 | STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
127 |
128 | # Directories for additional static files
129 | STATICFILES_DIRS = [
130 | os.path.join(BASE_DIR, 'static'), # Ensure this folder exists
131 | ]
--------------------------------------------------------------------------------
/staticfiles/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 | if (window.djdt) {
8 | // If Django Debug Toolbar is available, reinitialize it so that
9 | // it can show updated panels from new `docString`.
10 | window.addEventListener("load", djdt.init);
11 | }
12 | }
13 |
14 | function doAjaxSubmit(e) {
15 | var form = $(this);
16 | var btn = $(this.clk);
17 | var method = (
18 | btn.data('method') ||
19 | form.data('method') ||
20 | form.attr('method') || 'GET'
21 | ).toUpperCase();
22 |
23 | if (method === 'GET') {
24 | // GET requests can always use standard form submits.
25 | return;
26 | }
27 |
28 | var contentType =
29 | form.find('input[data-override="content-type"]').val() ||
30 | form.find('select[data-override="content-type"] option:selected').text();
31 |
32 | if (method === 'POST' && !contentType) {
33 | // POST requests can use standard form submits, unless we have
34 | // overridden the content type.
35 | return;
36 | }
37 |
38 | // At this point we need to make an AJAX form submission.
39 | e.preventDefault();
40 |
41 | var url = form.attr('action');
42 | var data;
43 |
44 | if (contentType) {
45 | data = form.find('[data-override="content"]').val() || ''
46 |
47 | if (contentType === 'multipart/form-data') {
48 | // We need to add a boundary parameter to the header
49 | // We assume the first valid-looking boundary line in the body is correct
50 | // regex is from RFC 2046 appendix A
51 | var boundaryCharNoSpace = "0-9A-Z'()+_,-./:=?";
52 | var boundaryChar = boundaryCharNoSpace + ' ';
53 | var re = new RegExp('^--([' + boundaryChar + ']{0,69}[' + boundaryCharNoSpace + '])[\\s]*?$', 'im');
54 | var boundary = data.match(re);
55 | if (boundary !== null) {
56 | contentType += '; boundary="' + boundary[1] + '"';
57 | }
58 | // Fix textarea.value EOL normalisation (multipart/form-data should use CR+NL, not NL)
59 | data = data.replace(/\n/g, '\r\n');
60 | }
61 | } else {
62 | contentType = form.attr('enctype') || form.attr('encoding')
63 |
64 | if (contentType === 'multipart/form-data') {
65 | if (!window.FormData) {
66 | alert('Your browser does not support AJAX multipart form submissions');
67 | return;
68 | }
69 |
70 | // Use the FormData API and allow the content type to be set automatically,
71 | // so it includes the boundary string.
72 | // See https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
73 | contentType = false;
74 | data = new FormData(form[0]);
75 | } else {
76 | contentType = 'application/x-www-form-urlencoded; charset=UTF-8'
77 | data = form.serialize();
78 | }
79 | }
80 |
81 | var ret = $.ajax({
82 | url: url,
83 | method: method,
84 | data: data,
85 | contentType: contentType,
86 | processData: false,
87 | headers: {
88 | 'Accept': 'text/html; q=1.0, */*'
89 | },
90 | });
91 |
92 | ret.always(function(data, textStatus, jqXHR) {
93 | if (textStatus != 'success') {
94 | jqXHR = data;
95 | }
96 |
97 | var responseContentType = jqXHR.getResponseHeader("content-type") || "";
98 |
99 | if (responseContentType.toLowerCase().indexOf('text/html') === 0) {
100 | replaceDocument(jqXHR.responseText);
101 |
102 | try {
103 | // Modify the location and scroll to top, as if after page load.
104 | history.replaceState({}, '', url);
105 | scroll(0, 0);
106 | } catch (err) {
107 | // History API not supported, so redirect.
108 | window.location = url;
109 | }
110 | } else {
111 | // Not HTML content. We can't open this directly, so redirect.
112 | window.location = url;
113 | }
114 | });
115 |
116 | return ret;
117 | }
118 |
119 | function captureSubmittingElement(e) {
120 | var target = e.target;
121 | var form = this;
122 |
123 | form.clk = target;
124 | }
125 |
126 | $.fn.ajaxForm = function() {
127 | var options = {}
128 |
129 | return this
130 | .unbind('submit.form-plugin click.form-plugin')
131 | .bind('submit.form-plugin', options, doAjaxSubmit)
132 | .bind('click.form-plugin', options, captureSubmittingElement);
133 | };
134 |
--------------------------------------------------------------------------------
/staticfiles/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 |
235 | .pagination {
236 | margin: 5px 0 10px 0;
237 | }
238 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/SelectBox.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | {
3 | const SelectBox = {
4 | cache: {},
5 | init: function(id) {
6 | const box = document.getElementById(id);
7 | SelectBox.cache[id] = [];
8 | const cache = SelectBox.cache[id];
9 | for (const node of box.options) {
10 | cache.push({value: node.value, text: node.text, displayed: 1});
11 | }
12 | },
13 | redisplay: function(id) {
14 | // Repopulate HTML select box from cache
15 | const box = document.getElementById(id);
16 | const scroll_value_from_top = box.scrollTop;
17 | box.innerHTML = '';
18 | for (const node of SelectBox.cache[id]) {
19 | if (node.displayed) {
20 | const new_option = new Option(node.text, node.value, false, false);
21 | // Shows a tooltip when hovering over the option
22 | new_option.title = node.text;
23 | box.appendChild(new_option);
24 | }
25 | }
26 | box.scrollTop = scroll_value_from_top;
27 | },
28 | filter: function(id, text) {
29 | // Redisplay the HTML select box, displaying only the choices containing ALL
30 | // the words in text. (It's an AND search.)
31 | const tokens = text.toLowerCase().split(/\s+/);
32 | for (const node of SelectBox.cache[id]) {
33 | node.displayed = 1;
34 | const node_text = node.text.toLowerCase();
35 | for (const token of tokens) {
36 | if (!node_text.includes(token)) {
37 | node.displayed = 0;
38 | break; // Once the first token isn't found we're done
39 | }
40 | }
41 | }
42 | SelectBox.redisplay(id);
43 | },
44 | get_hidden_node_count(id) {
45 | const cache = SelectBox.cache[id] || [];
46 | return cache.filter(node => node.displayed === 0).length;
47 | },
48 | delete_from_cache: function(id, value) {
49 | let delete_index = null;
50 | const cache = SelectBox.cache[id];
51 | for (const [i, node] of cache.entries()) {
52 | if (node.value === value) {
53 | delete_index = i;
54 | break;
55 | }
56 | }
57 | cache.splice(delete_index, 1);
58 | },
59 | add_to_cache: function(id, option) {
60 | SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
61 | },
62 | cache_contains: function(id, value) {
63 | // Check if an item is contained in the cache
64 | for (const node of SelectBox.cache[id]) {
65 | if (node.value === value) {
66 | return true;
67 | }
68 | }
69 | return false;
70 | },
71 | move: function(from, to) {
72 | const from_box = document.getElementById(from);
73 | for (const option of from_box.options) {
74 | const option_value = option.value;
75 | if (option.selected && SelectBox.cache_contains(from, option_value)) {
76 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
77 | SelectBox.delete_from_cache(from, option_value);
78 | }
79 | }
80 | SelectBox.redisplay(from);
81 | SelectBox.redisplay(to);
82 | },
83 | move_all: function(from, to) {
84 | const from_box = document.getElementById(from);
85 | for (const option of from_box.options) {
86 | const option_value = option.value;
87 | if (SelectBox.cache_contains(from, option_value)) {
88 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
89 | SelectBox.delete_from_cache(from, option_value);
90 | }
91 | }
92 | SelectBox.redisplay(from);
93 | SelectBox.redisplay(to);
94 | },
95 | sort: function(id) {
96 | SelectBox.cache[id].sort(function(a, b) {
97 | a = a.text.toLowerCase();
98 | b = b.text.toLowerCase();
99 | if (a > b) {
100 | return 1;
101 | }
102 | if (a < b) {
103 | return -1;
104 | }
105 | return 0;
106 | } );
107 | },
108 | select_all: function(id) {
109 | const box = document.getElementById(id);
110 | for (const option of box.options) {
111 | option.selected = true;
112 | }
113 | }
114 | };
115 | window.SelectBox = SelectBox;
116 | }
117 |
--------------------------------------------------------------------------------
/cardapp/views.py:
--------------------------------------------------------------------------------
1 | from rest_framework import viewsets
2 | from .models import Card
3 | from rest_framework.views import APIView
4 | from .serializers import CardSerializer, TransacsionSerializer, UpdatePasswordCardSerializer, UpdateDataCardSerializer, AddMoneySerializer, AddCardSerializer
5 | from rest_framework.response import Response
6 |
7 | class barcha_card(APIView):
8 | def get(self, request):
9 | cardlar = Card.objects.all()
10 | serializer2 = CardSerializer(cardlar, many=True)
11 | return Response(serializer2.data)
12 |
13 |
14 | class Transacsion(APIView):
15 | serializer_class = TransacsionSerializer
16 |
17 | def post(self, request):
18 | user_id = request.data.get('user_id')
19 | sender_card = request.data.get('sender_card')
20 | reciver_card = request.data.get('sender_card')
21 | money = float(request.data.get('money'))
22 | money2 = money - money / 100
23 | user = Card.objects.all().filter(card_holder=user_id, card_number=sender_card)
24 | if user:
25 | for i in user:
26 | qoldi = i.money - money
27 | Card.objects.all().filter(card_number=sender_card).update(money=qoldi)
28 | if i.money >= money:
29 | old_money = Card.objects.all().filter(card_number=reciver_card)
30 | if old_money:
31 | for i in old_money:
32 | all_money = Card.objects.all().filter(card_number=reciver_card).update(
33 | money=money2 + i.money)
34 |
35 | return Response({'message': f"Pul jo`natildi {money2}"}, status=201)
36 | return Response({'message': f"Bunday karta raqam topilmadi"}, status=404)
37 | return Response({'message': f"Sizda yetarli Mablag` yoq"}, status=200)
38 | return Response({"message": 'Bunday foydalanuvchi topilmadi'}, status=404)
39 |
40 |
41 | class TopMoneyCard(APIView):
42 | def get(self, request):
43 | card = Card.objects.all().order_by('?') # Tasodifiy tartibda olib keladi
44 | serializer = CardSerializer(card, many=True)
45 | return Response(serializer.data)
46 |
47 |
48 | class UpdatePasswordCardAPI(APIView):
49 | serializer_class = UpdatePasswordCardSerializer
50 | def put(self,request):
51 | card_number = request.data.get('card_number')
52 | old_card_pin_code = request.data.get('old_card_pin_code')
53 | new_card_pin_code = request.data.get('new_card_pin_code')
54 | if Card.objects.all().filter(card_number=card_number, card_pin_code=old_card_pin_code).exists():
55 | Card.objects.filter(card_number=card_number).update(card_pin_code=new_card_pin_code)
56 | return Response({"message": "Pincode updated successfully"}, status=200)
57 | else:
58 | return Response({"message": "Card not found or pincode does not exist"}, status=404)
59 |
60 |
61 | class AddMoneyApi(APIView):
62 | serializer_class = AddMoneySerializer
63 |
64 | def put(self, request):
65 | money = request.data.get('money')
66 | card_number = request.data.get('card_number')
67 |
68 | # "money" qiymatini tekshirish
69 | if not money:
70 | return Response({"error": "Money field is required"}, status=400)
71 |
72 | try:
73 | money = float(money)
74 | except ValueError:
75 | return Response({"error": "Invalid money value"}, status=400)
76 |
77 | # Karta mavjudligini tekshirish
78 | old_money = Card.objects.filter(card_number=card_number).first()
79 | if old_money is None:
80 | return Response({"error": "Card not found"}, status=404)
81 |
82 | summ = float(old_money.money) + money
83 |
84 | # Pul miqdorini yangilash
85 | Card.objects.filter(card_number=card_number).update(money=summ)
86 |
87 | return Response({"message": "Money added successfully"}, status=200)
88 |
89 |
90 |
91 | # class All_Card(APIView):
92 | # def get(self, request):
93 | # cards = Card.objects.all()
94 | # serializers = CardSerializer(cards, many=True)
95 | # return Response(serializers.data)
96 |
97 |
98 | class AddCard(APIView):
99 | def post(self,request):
100 | serializers = AddCardSerializer(data=request.data)
101 | if serializers.is_valid():
102 | serializers.save()
103 | return Response({"message": "Card added succesfully"},status=200)
104 | return Response({"message": "Error"},status=404)
105 |
106 |
107 | # class DeleteCard(APIView):
108 | # def delete(self,request,id):
109 | # try:
110 | # card = Card.objects.all().filter(id=id).delete()
111 | # return Response({"message":"Card delete succesfullly"},status=200)
112 | # except Card.DoesNotExist:
113 | # return Response({"message": "Card not found"},status=400)
114 |
115 |
116 | # class UpdateCardAPI(APIView):
117 | # serializer_class = UpdateDataCardSerializer
118 |
119 | # def patch(self, request):
120 | # card_number = request.data.get('card_number')
121 | # try:
122 | # card = Card.objects.get(card_number=card_number)
123 | # ex cept Card.DoesNotExist:
124 | # return Response({"message": "Card not found"}, status=404)
125 |
126 | # serializer = self.serializer_class(card, data=request.data, partial=True)
127 | # if serializer.is_valid():
128 | # serializer.save()
129 | # return Response({"message": "Card updated successfully", "data": serializer.data}, status=200)
130 | # return Response(serializer.errors, status=400)
131 |
--------------------------------------------------------------------------------
/staticfiles/admin/js/core.js:
--------------------------------------------------------------------------------
1 | // Core JavaScript helper functions
2 | 'use strict';
3 |
4 | // quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
5 | function quickElement() {
6 | const obj = document.createElement(arguments[0]);
7 | if (arguments[2]) {
8 | const textNode = document.createTextNode(arguments[2]);
9 | obj.appendChild(textNode);
10 | }
11 | const len = arguments.length;
12 | for (let i = 3; i < len; i += 2) {
13 | obj.setAttribute(arguments[i], arguments[i + 1]);
14 | }
15 | arguments[1].appendChild(obj);
16 | return obj;
17 | }
18 |
19 | // "a" is reference to an object
20 | function removeChildren(a) {
21 | while (a.hasChildNodes()) {
22 | a.removeChild(a.lastChild);
23 | }
24 | }
25 |
26 | // ----------------------------------------------------------------------------
27 | // Find-position functions by PPK
28 | // See https://www.quirksmode.org/js/findpos.html
29 | // ----------------------------------------------------------------------------
30 | function findPosX(obj) {
31 | let curleft = 0;
32 | if (obj.offsetParent) {
33 | while (obj.offsetParent) {
34 | curleft += obj.offsetLeft - obj.scrollLeft;
35 | obj = obj.offsetParent;
36 | }
37 | } else if (obj.x) {
38 | curleft += obj.x;
39 | }
40 | return curleft;
41 | }
42 |
43 | function findPosY(obj) {
44 | let curtop = 0;
45 | if (obj.offsetParent) {
46 | while (obj.offsetParent) {
47 | curtop += obj.offsetTop - obj.scrollTop;
48 | obj = obj.offsetParent;
49 | }
50 | } else if (obj.y) {
51 | curtop += obj.y;
52 | }
53 | return curtop;
54 | }
55 |
56 | //-----------------------------------------------------------------------------
57 | // Date object extensions
58 | // ----------------------------------------------------------------------------
59 | {
60 | Date.prototype.getTwelveHours = function() {
61 | return this.getHours() % 12 || 12;
62 | };
63 |
64 | Date.prototype.getTwoDigitMonth = function() {
65 | return (this.getMonth() < 9) ? '0' + (this.getMonth() + 1) : (this.getMonth() + 1);
66 | };
67 |
68 | Date.prototype.getTwoDigitDate = function() {
69 | return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate();
70 | };
71 |
72 | Date.prototype.getTwoDigitTwelveHour = function() {
73 | return (this.getTwelveHours() < 10) ? '0' + this.getTwelveHours() : this.getTwelveHours();
74 | };
75 |
76 | Date.prototype.getTwoDigitHour = function() {
77 | return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours();
78 | };
79 |
80 | Date.prototype.getTwoDigitMinute = function() {
81 | return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes();
82 | };
83 |
84 | Date.prototype.getTwoDigitSecond = function() {
85 | return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds();
86 | };
87 |
88 | Date.prototype.getAbbrevMonthName = function() {
89 | return typeof window.CalendarNamespace === "undefined"
90 | ? this.getTwoDigitMonth()
91 | : window.CalendarNamespace.monthsOfYearAbbrev[this.getMonth()];
92 | };
93 |
94 | Date.prototype.getFullMonthName = function() {
95 | return typeof window.CalendarNamespace === "undefined"
96 | ? this.getTwoDigitMonth()
97 | : window.CalendarNamespace.monthsOfYear[this.getMonth()];
98 | };
99 |
100 | Date.prototype.strftime = function(format) {
101 | const fields = {
102 | b: this.getAbbrevMonthName(),
103 | B: this.getFullMonthName(),
104 | c: this.toString(),
105 | d: this.getTwoDigitDate(),
106 | H: this.getTwoDigitHour(),
107 | I: this.getTwoDigitTwelveHour(),
108 | m: this.getTwoDigitMonth(),
109 | M: this.getTwoDigitMinute(),
110 | p: (this.getHours() >= 12) ? 'PM' : 'AM',
111 | S: this.getTwoDigitSecond(),
112 | w: '0' + this.getDay(),
113 | x: this.toLocaleDateString(),
114 | X: this.toLocaleTimeString(),
115 | y: ('' + this.getFullYear()).substr(2, 4),
116 | Y: '' + this.getFullYear(),
117 | '%': '%'
118 | };
119 | let result = '', i = 0;
120 | while (i < format.length) {
121 | if (format.charAt(i) === '%') {
122 | result += fields[format.charAt(i + 1)];
123 | ++i;
124 | }
125 | else {
126 | result += format.charAt(i);
127 | }
128 | ++i;
129 | }
130 | return result;
131 | };
132 |
133 | // ----------------------------------------------------------------------------
134 | // String object extensions
135 | // ----------------------------------------------------------------------------
136 | String.prototype.strptime = function(format) {
137 | const split_format = format.split(/[.\-/]/);
138 | const date = this.split(/[.\-/]/);
139 | let i = 0;
140 | let day, month, year;
141 | while (i < split_format.length) {
142 | switch (split_format[i]) {
143 | case "%d":
144 | day = date[i];
145 | break;
146 | case "%m":
147 | month = date[i] - 1;
148 | break;
149 | case "%Y":
150 | year = date[i];
151 | break;
152 | case "%y":
153 | // A %y value in the range of [00, 68] is in the current
154 | // century, while [69, 99] is in the previous century,
155 | // according to the Open Group Specification.
156 | if (parseInt(date[i], 10) >= 69) {
157 | year = date[i];
158 | } else {
159 | year = (new Date(Date.UTC(date[i], 0))).getUTCFullYear() + 100;
160 | }
161 | break;
162 | }
163 | ++i;
164 | }
165 | // Create Date object from UTC since the parsed value is supposed to be
166 | // in UTC, not local time. Also, the calendar uses UTC functions for
167 | // date extraction.
168 | return new Date(Date.UTC(year, month, day));
169 | };
170 | }
171 |
--------------------------------------------------------------------------------
/staticfiles/admin/css/rtl.css:
--------------------------------------------------------------------------------
1 | /* GLOBAL */
2 |
3 | th {
4 | text-align: right;
5 | }
6 |
7 | .module h2, .module caption {
8 | text-align: right;
9 | }
10 |
11 | .module ul, .module ol {
12 | margin-left: 0;
13 | margin-right: 1.5em;
14 | }
15 |
16 | .viewlink, .addlink, .changelink {
17 | padding-left: 0;
18 | padding-right: 16px;
19 | background-position: 100% 1px;
20 | }
21 |
22 | .deletelink {
23 | padding-left: 0;
24 | padding-right: 16px;
25 | background-position: 100% 1px;
26 | }
27 |
28 | .object-tools {
29 | float: left;
30 | }
31 |
32 | thead th:first-child,
33 | tfoot td:first-child {
34 | border-left: none;
35 | }
36 |
37 | /* LAYOUT */
38 |
39 | #user-tools {
40 | right: auto;
41 | left: 0;
42 | text-align: left;
43 | }
44 |
45 | div.breadcrumbs {
46 | text-align: right;
47 | }
48 |
49 | #content-main {
50 | float: right;
51 | }
52 |
53 | #content-related {
54 | float: left;
55 | margin-left: -300px;
56 | margin-right: auto;
57 | }
58 |
59 | .colMS {
60 | margin-left: 300px;
61 | margin-right: 0;
62 | }
63 |
64 | /* SORTABLE TABLES */
65 |
66 | table thead th.sorted .sortoptions {
67 | float: left;
68 | }
69 |
70 | thead th.sorted .text {
71 | padding-right: 0;
72 | padding-left: 42px;
73 | }
74 |
75 | /* dashboard styles */
76 |
77 | .dashboard .module table td a {
78 | padding-left: .6em;
79 | padding-right: 16px;
80 | }
81 |
82 | /* changelists styles */
83 |
84 | .change-list .filtered table {
85 | border-left: none;
86 | border-right: 0px none;
87 | }
88 |
89 | #changelist-filter {
90 | border-left: none;
91 | border-right: none;
92 | margin-left: 0;
93 | margin-right: 30px;
94 | }
95 |
96 | #changelist-filter li.selected {
97 | border-left: none;
98 | padding-left: 10px;
99 | margin-left: 0;
100 | border-right: 5px solid var(--hairline-color);
101 | padding-right: 10px;
102 | margin-right: -15px;
103 | }
104 |
105 | #changelist table tbody td:first-child, #changelist table tbody th:first-child {
106 | border-right: none;
107 | border-left: none;
108 | }
109 |
110 | .paginator .end {
111 | margin-left: 6px;
112 | margin-right: 0;
113 | }
114 |
115 | .paginator input {
116 | margin-left: 0;
117 | margin-right: auto;
118 | }
119 |
120 | /* FORMS */
121 |
122 | .aligned label {
123 | padding: 0 0 3px 1em;
124 | }
125 |
126 | .submit-row a.deletelink {
127 | margin-left: 0;
128 | margin-right: auto;
129 | }
130 |
131 | .vDateField, .vTimeField {
132 | margin-left: 2px;
133 | }
134 |
135 | .aligned .form-row input {
136 | margin-left: 5px;
137 | }
138 |
139 | form .aligned ul {
140 | margin-right: 163px;
141 | padding-right: 10px;
142 | margin-left: 0;
143 | padding-left: 0;
144 | }
145 |
146 | form ul.inline li {
147 | float: right;
148 | padding-right: 0;
149 | padding-left: 7px;
150 | }
151 |
152 | form .aligned p.help,
153 | form .aligned div.help {
154 | margin-right: 160px;
155 | padding-right: 10px;
156 | }
157 |
158 | form div.help ul,
159 | form .aligned .checkbox-row + .help,
160 | form .aligned p.date div.help.timezonewarning,
161 | form .aligned p.datetime div.help.timezonewarning,
162 | form .aligned p.time div.help.timezonewarning {
163 | margin-right: 0;
164 | padding-right: 0;
165 | }
166 |
167 | form .wide p.help, form .wide div.help {
168 | padding-left: 0;
169 | padding-right: 50px;
170 | }
171 |
172 | form .wide p,
173 | form .wide ul.errorlist,
174 | form .wide input + p.help,
175 | form .wide input + div.help {
176 | margin-right: 200px;
177 | margin-left: 0px;
178 | }
179 |
180 | .submit-row {
181 | text-align: right;
182 | }
183 |
184 | fieldset .fieldBox {
185 | margin-left: 20px;
186 | margin-right: 0;
187 | }
188 |
189 | .errorlist li {
190 | background-position: 100% 12px;
191 | padding: 0;
192 | }
193 |
194 | .errornote {
195 | background-position: 100% 12px;
196 | padding: 10px 12px;
197 | }
198 |
199 | /* WIDGETS */
200 |
201 | .calendarnav-previous {
202 | top: 0;
203 | left: auto;
204 | right: 10px;
205 | background: url(../img/calendar-icons.svg) 0 -30px no-repeat;
206 | }
207 |
208 | .calendarbox .calendarnav-previous:focus,
209 | .calendarbox .calendarnav-previous:hover {
210 | background-position: 0 -45px;
211 | }
212 |
213 | .calendarnav-next {
214 | top: 0;
215 | right: auto;
216 | left: 10px;
217 | background: url(../img/calendar-icons.svg) 0 0 no-repeat;
218 | }
219 |
220 | .calendarbox .calendarnav-next:focus,
221 | .calendarbox .calendarnav-next:hover {
222 | background-position: 0 -15px;
223 | }
224 |
225 | .calendar caption, .calendarbox h2 {
226 | text-align: center;
227 | }
228 |
229 | .selector {
230 | float: right;
231 | }
232 |
233 | .selector .selector-filter {
234 | text-align: right;
235 | }
236 |
237 | .selector-add {
238 | background: url(../img/selector-icons.svg) 0 -64px no-repeat;
239 | }
240 |
241 | .active.selector-add:focus, .active.selector-add:hover {
242 | background-position: 0 -80px;
243 | }
244 |
245 | .selector-remove {
246 | background: url(../img/selector-icons.svg) 0 -96px no-repeat;
247 | }
248 |
249 | .active.selector-remove:focus, .active.selector-remove:hover {
250 | background-position: 0 -112px;
251 | }
252 |
253 | a.selector-chooseall {
254 | background: url(../img/selector-icons.svg) right -128px no-repeat;
255 | }
256 |
257 | a.active.selector-chooseall:focus, a.active.selector-chooseall:hover {
258 | background-position: 100% -144px;
259 | }
260 |
261 | a.selector-clearall {
262 | background: url(../img/selector-icons.svg) 0 -160px no-repeat;
263 | }
264 |
265 | a.active.selector-clearall:focus, a.active.selector-clearall:hover {
266 | background-position: 0 -176px;
267 | }
268 |
269 | .inline-deletelink {
270 | float: left;
271 | }
272 |
273 | form .form-row p.datetime {
274 | overflow: hidden;
275 | }
276 |
277 | .related-widget-wrapper {
278 | float: right;
279 | }
280 |
281 | /* MISC */
282 |
283 | .inline-related h2, .inline-group h2 {
284 | text-align: right
285 | }
286 |
287 | .inline-related h3 span.delete {
288 | padding-right: 20px;
289 | padding-left: inherit;
290 | left: 10px;
291 | right: inherit;
292 | float:left;
293 | }
294 |
295 | .inline-related h3 span.delete label {
296 | margin-left: inherit;
297 | margin-right: 2px;
298 | }
299 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/js/change_form.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | 'use strict';
3 |
4 | function FixSelectorHeight() {
5 | $('.selector .selector-chosen').each(function () {
6 | let selector_chosen = $(this);
7 | let selector_available = selector_chosen.siblings('.selector-available');
8 |
9 | let selector_chosen_select = selector_chosen.find('select').first();
10 | let selector_available_select = selector_available.find('select').first();
11 | let selector_available_filter = selector_available.find('p.selector-filter').first();
12 |
13 | selector_chosen_select.height(selector_available_select.height() + selector_available_filter.outerHeight());
14 | selector_chosen_select.css('border-top', selector_chosen_select.css('border-bottom'));
15 | });
16 | }
17 |
18 | function handleCarousel($carousel) {
19 | const errors = $('.errorlist li', $carousel);
20 | const hash = document.location.hash;
21 |
22 | // If we have errors, open that tab first
23 | if (errors.length) {
24 | const errorCarousel = errors.eq(0).closest('.carousel-item');
25 | $carousel.carousel(errorCarousel.data('carouselid'));
26 | $('.carousel-fieldset-label', $carousel).text(errorCarousel.data()["label"]);
27 | } else if (hash) {
28 | // If we have a tab hash, open that
29 | const activeCarousel = $('.carousel-item[data-target="' + hash + '"]', $carousel);
30 | $carousel.carousel(activeCarousel.data()["carouselid"]);
31 | $('.carousel-fieldset-label', $carousel).text(activeCarousel.data()["label"]);
32 | }
33 |
34 | // Update page hash/history on slide
35 | $carousel.on('slide.bs.carousel', function (e) {
36 |
37 | FixSelectorHeight();
38 | // call resize in change view after tab switch
39 | window.dispatchEvent(new Event('resize'));
40 |
41 | if (e.relatedTarget.dataset.hasOwnProperty("label")) {
42 | $('.carousel-fieldset-label', $carousel).text(e.relatedTarget.dataset.label);
43 | }
44 | const hash = e.relatedTarget.dataset.target;
45 |
46 | if (history.pushState) {
47 | history.pushState(null, null, hash);
48 | } else {
49 | location.hash = hash;
50 | }
51 | });
52 | }
53 |
54 | function handleTabs($tabs) {
55 | const errors = $('.change-form .errorlist li');
56 | const hash = document.location.hash;
57 |
58 | // If we have errors, open that tab first
59 | if (errors.length) {
60 | const tabId = errors.eq(0).closest('.tab-pane').attr('id');
61 | $('a[href="#' + tabId + '"]').tab('show');
62 | } else if (hash) {
63 | // If we have a tab hash, open that
64 | $('a[href="' + hash + '"]', $tabs).tab('show');
65 | }
66 |
67 | // Change hash for page-reload
68 | $('a', $tabs).on('shown.bs.tab', function (e) {
69 |
70 | FixSelectorHeight();
71 | // call resize in change view after tab switch
72 | window.dispatchEvent(new Event('resize'));
73 |
74 | e.preventDefault();
75 | if (history.pushState) {
76 | history.pushState(null, null, e.target.hash);
77 | } else {
78 | location.hash = e.target.hash;
79 | }
80 | });
81 | }
82 |
83 | function handleCollapsible($collapsible) {
84 | const errors = $('.errorlist li', $collapsible);
85 | const hash = document.location.hash;
86 |
87 | // If we have errors, open that tab first
88 | if (errors.length) {
89 | $('.panel-collapse', $collapsible).collapse('hide');
90 | errors.eq(0).closest('.panel-collapse').collapse('show');
91 |
92 | } else if (hash) {
93 | // If we have a tab hash, open that
94 | $('.panel-collapse', $collapsible).collapse('hide');
95 | $(hash, $collapsible).collapse('show');
96 | }
97 |
98 | // Change hash for page-reload
99 | $collapsible.on('shown.bs.collapse', function (e) {
100 |
101 | FixSelectorHeight();
102 | // call resize in change view after tab switch
103 | window.dispatchEvent(new Event('resize'));
104 |
105 | if (history.pushState) {
106 | history.pushState(null, null, '#' + e.target.id);
107 | } else {
108 | location.hash = '#' + e.target.id;
109 | }
110 | });
111 | }
112 |
113 | function applySelect2() {
114 | // Apply select2 to any select boxes that don't yet have it
115 | // and are not part of the django's empty-form inline
116 | const noSelect2 = '.empty-form select, .select2-hidden-accessible, .selectfilter, .selector-available select, .selector-chosen select, select[data-autocomplete-light-function=select2]';
117 | $('select').not(noSelect2).select2({ width: 'element' });
118 | }
119 |
120 | $(document).ready(function () {
121 | const $carousel = $('#content-main form #jazzy-carousel');
122 | const $tabs = $('#content-main form #jazzy-tabs');
123 | const $collapsible = $('#content-main form #jazzy-collapsible');
124 |
125 | // Ensure all raw_id_fields have the search icon in them
126 | $('.related-lookup').append('');
127 |
128 | // Style the inline fieldset button
129 | $('.inline-related fieldset.module .add-row a').addClass('btn btn-sm btn-default float-right');
130 | $('div.add-row>a').addClass('btn btn-sm btn-default float-right');
131 |
132 | // Ensure we preserve the tab the user was on using the url hash, even on page reload
133 | if ($tabs.length) { handleTabs($tabs); }
134 | else if ($carousel.length) { handleCarousel($carousel); }
135 | else if ($collapsible.length) { handleCollapsible($collapsible); }
136 |
137 | applySelect2();
138 |
139 | $('body').on('change', '.related-widget-wrapper select', function(e) {
140 | const event = $.Event('django:update-related');
141 | $(this).trigger(event);
142 | if (!event.isDefaultPrevented() && typeof(window.updateRelatedObjectLinks) !== 'undefined') {
143 | updateRelatedObjectLinks(this);
144 | }
145 | });
146 | });
147 |
148 | // Apply select2 to all select boxes when new inline row is created
149 | django.jQuery(document).on('formset:added', applySelect2);
150 |
151 | })(jQuery);
152 |
--------------------------------------------------------------------------------
/usersapp/views.py:
--------------------------------------------------------------------------------
1 | from django.core.paginator import Paginator
2 | from django.shortcuts import render
3 | from rest_framework.views import APIView
4 | from rest_framework.response import Response
5 | from rest_framework import status
6 | from .models import User
7 | from .serializers import UpdatePasswordSerializer, UserSerializer, UpdateDataSerializer
8 | from django.core.paginator import Paginator
9 | from django.shortcuts import render
10 | from rest_framework.pagination import PageNumberPagination
11 |
12 |
13 | def listing(request):
14 | contact_list = Contact.objects.all()
15 | paginator = Paginator(contact_list, 25) # Show 25 contacts per page.
16 | page_number = request.GET.get("page")
17 | page_obj = paginator.get_page(page_number)
18 | return render(request, "list.html", {"page_obj": page_obj})
19 |
20 |
21 | class RegisterView(APIView):
22 | def post(self, request):
23 | serializer = UserSerializer(data=request.data)
24 | if serializer.is_valid():
25 | serializer.save()
26 | return Response({"message": "User registered successfully"}, status=status.HTTP_201_CREATED)
27 | return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
28 |
29 |
30 | class LoginView(APIView):
31 | def post(self, request):
32 | first_name = request.data.get('first_name')
33 | password = request.data.get('password')
34 | user = User.objects.filter(first_name=first_name, password=password).first()
35 | if user:
36 | serializer = UserSerializer(user)
37 | return Response({"message": "Login successful", "user": serializer.data}, status=200)
38 | return Response({"detail": "Invalid credentials"}, status=401)
39 |
40 |
41 | # class AllUsersView(APIView):
42 | # def get(self, request):
43 | # users = User.objects.all()
44 | # serializer = UserSerializer(users, many=True)
45 | # return Response(serializer.data, status=status.HTTP_200_OK)
46 |
47 |
48 |
49 |
50 | class AllUsersView(APIView):
51 | def get(self, request):
52 | users = User.objects.all()
53 | <<<<<<< HEAD
54 | paginator = Paginator(users, 5)
55 | page_number = request.GET.get("page")
56 | page_obj = paginator.get_page(page_number)
57 | serializer = UserSerializer(page_obj, many=True)
58 | return Response({"users": serializer.data, "total_pages": paginator.num_pages}, status=status.HTTP_200_OK)
59 | =======
60 | paginator = Paginator(users,5)
61 |
62 | page_number = request.GET.get("page")
63 | page_obj = paginator.get_page(page_number)
64 | serializer = UserSerializer(page_obj, many=True)
65 | return Response({
66 | "count": paginator.count,
67 | "total_pages": paginator.num_pages,
68 | "current_page": page_obj.number,
69 | "next": page_obj.next_page_number() if page_obj.has_next() else None,
70 | "previous": page_obj.previous_page_number() if page_obj.has_previous() else None,
71 | "results": serializer.data
72 | }, status=status.HTTP_200_OK)
73 | # return Response(serializer.data, status=status.HTTP_200_OK)
74 |
75 | def options(self, request, *args, **kwargs):
76 | custom_metadata = {
77 | 'allowed_methods': ['GET', 'OPTIONS'],
78 | 'endpoint_description': 'Show all users in database',
79 | 'available_filters': ['id','username'],
80 | 'pagination': {
81 | 'page_size': 10,
82 | 'max_page_size': 100
83 | },
84 | 'custom_info': {
85 | 'version': '1.0',
86 | 'developer': 'Diyas',
87 | 'last_updated': '2024-02-11'
88 | }
89 | }
90 |
91 | return Response(custom_metadata, status=status.HTTP_200_OK)
92 | >>>>>>> eb83767 (custom admin site | add paginator #16)
93 |
94 |
95 | class UserDetailView(APIView):
96 | def get(self, request, id):
97 | user = User.objects.filter(id=id).first()
98 | if not user:
99 | return Response({"detail": "User not found"}, status=status.HTTP_404_NOT_FOUND)
100 | serializer = UserSerializer(user)
101 | return Response(serializer.data, status=status.HTTP_200_OK)
102 |
103 |
104 | class UpdatePasswordUser(APIView):
105 | serializer_class = UpdatePasswordSerializer
106 |
107 | def put(self, request):
108 | first_name = request.data.get('first_name')
109 | old_password = request.data.get('old_password')
110 | new_password = request.data.get('new_password')
111 | <<<<<<< HEAD
112 | user = User.objects.filter(username=username, password=old_password).first()
113 | if user:
114 | user.password = new_password
115 | user.save()
116 | =======
117 | if User.objects.all().filter(first_name=first_name, password=old_password).exists():
118 | User.objects.filter(first_name=first_name).update(password=new_password)
119 | >>>>>>> eb83767 (custom admin site | add paginator #16)
120 | return Response({"message": "Password updated successfully"}, status=status.HTTP_200_OK)
121 | return Response({"detail": "User not found or Password Incorrect"}, status=status.HTTP_400_BAD_REQUEST)
122 |
123 |
124 | class UpdateData(APIView):
125 | serializer_class = UpdateDataSerializer
126 |
127 | def patch(self, request):
128 | first_name = request.data.get('first_name')
129 | old_password = request.data.get('old_password')
130 | new_password = request.data.get('new_password')
131 | <<<<<<< HEAD
132 | new_username = request.data.get('new_username')
133 | user = User.objects.filter(username=username, password=old_password).first()
134 | if user:
135 | user.username = new_username
136 | user.password = new_password
137 | user.save()
138 | =======
139 | new_first_name = request.data.get('new_first_name')
140 | if User.objects.all().filter(first_name=first_name, password=old_password).exists():
141 | User.objects.filter(first_name=first_name).update(password=new_password, first_name=new_first_name)
142 | >>>>>>> eb83767 (custom admin site | add paginator #16)
143 | return Response({"message": "User Data updated successfully"}, status=status.HTTP_200_OK)
144 | return Response({"detail": "User not found or Password Incorrect"}, status=status.HTTP_400_BAD_REQUEST)
145 |
146 |
147 | class DeleteUserAPI(APIView):
148 | def delete(self, request, id):
149 | user = User.objects.filter(id=id).first()
150 | if not user:
151 | return Response({"detail": "User not found"}, status=status.HTTP_400_BAD_REQUEST)
152 | user.delete()
153 | return Response({"message": f"User Data deleted successfully User id: {id}"}, status=status.HTTP_200_OK)
154 |
--------------------------------------------------------------------------------
/staticfiles/jazzmin/js/related-modal.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | 'use strict';
3 |
4 | let relatedModalCounter = 0;
5 |
6 | function checkIfInIframe() {
7 | return window.top !== window.self;
8 | }
9 |
10 | // create the function that will close the modal
11 | function dismissModal() {
12 | if (checkIfInIframe()) {
13 | const parentWindow = window.parent;
14 | parentWindow.dismissModal();
15 | return;
16 | }
17 |
18 | $('.related-modal-' + relatedModalCounter).modal('hide');
19 |
20 | relatedModalCounter-=1;
21 | }
22 |
23 | // create the function that will show the modal
24 | function showModal(title, body, e) {
25 | if (checkIfInIframe()) {
26 | const parentWindow = window.parent;
27 | parentWindow.showModal(title, body, e);
28 | return;
29 | }
30 |
31 | relatedModalCounter+=1;
32 |
33 |
34 | $.showModal({
35 | title: title,
36 | body: body,
37 | backdrop: false,
38 | modalDialogClass: "modal-dialog-centered modal-lg",
39 | modalClass: "fade modal-wide related-modal-" + relatedModalCounter,
40 | onDispose: function() {
41 | // add focus to the previous modal (if exists) when the current one is closed
42 | var lastModal = $("div[class*='related-modal-']").last();
43 | if (lastModal) {
44 | lastModal.focus();
45 | }
46 | }
47 | });
48 |
49 | const modalEl = $("div[class*='related-modal-']");
50 | const iframeEl = modalEl.find('#related-modal-iframe');
51 |
52 | if (e.data.lookup === true) {
53 | // set current window as iframe opener because
54 | // the callback is called on the opener window
55 | iframeEl.on('load', function() {
56 | const iframeObj = $(this).get(0);
57 | const iframeWindow = iframeObj.contentWindow;
58 | iframeWindow.opener = window;
59 | });
60 | }
61 | }
62 |
63 | function dismissRelatedLookupModal(win, chosenId) {
64 | const windowName = win.name;
65 | const widgetName = windowName.replace(/^(change|add|delete|lookup)_/, '');
66 | let widgetEl;
67 |
68 | if (checkIfInIframe) {
69 | // select second to last iframe in the main parent document
70 | const secondLastIframe = $('iframe.related-iframe', win.parent.document).eq(-2);
71 | let documentContext;
72 |
73 | // if second to last iframe exists get its contents
74 | if (secondLastIframe.length) {
75 | documentContext = secondLastIframe.contents();
76 |
77 | // else get main parent document
78 | } else {
79 | documentContext = $(win.parent.document);
80 | }
81 |
82 | // find and select widget from the specified document context
83 | widgetEl = documentContext.find('#' + widgetName);
84 |
85 | // else select widget from the main document
86 | } else {
87 | widgetEl = $('#' + widgetName);
88 | }
89 |
90 | const widgetVal = widgetEl.val();
91 | if (widgetEl.hasClass('vManyToManyRawIdAdminField') && Boolean(widgetVal)) {
92 | widgetEl.val(widgetVal + ', ' + chosenId);
93 | } else {
94 | widgetEl.val(chosenId);
95 | }
96 | dismissModal();
97 | }
98 |
99 | // assign functions to global variables
100 | window.dismissRelatedObjectModal = dismissModal;
101 | window.dismissRelatedLookupPopup = dismissRelatedLookupModal;
102 | window.showModal = showModal;
103 |
104 | function presentRelatedObjectModal(e) {
105 | let linkEl = $(this);
106 | let href = (linkEl.attr('href') || '');
107 |
108 | if (href === '') {
109 | return;
110 | }
111 |
112 | // open the popup as modal
113 | e.preventDefault();
114 | e.stopImmediatePropagation();
115 |
116 | // remove focus from clicked link
117 | linkEl.blur();
118 |
119 | // use the clicked link id as iframe name
120 | // it will be available as window.name in the loaded iframe
121 | let iframeName = linkEl.attr('id');
122 | let iframeSrc = href;
123 | const modalTitle = linkEl.attr('title');
124 |
125 | if (e.data.lookup !== true) {
126 | // browsers stop loading nested iframes having the same src url
127 | // create a random parameter and append it to the src url to prevent it
128 | // this workaround doesn't work with related lookup url
129 | let iframeSrcRandom = String(Math.round(Math.random() * 999999));
130 | if (iframeSrc.indexOf('?') === -1) {
131 | iframeSrc += '?_modal=' + iframeSrcRandom;
132 | } else {
133 | iframeSrc += '&_modal=' + iframeSrcRandom;
134 | }
135 | }
136 |
137 | if (iframeSrc.indexOf('_popup=1') === -1) {
138 | if (iframeSrc.indexOf('?') === -1) {
139 | iframeSrc += '?_popup=1';
140 | } else {
141 | iframeSrc += '&_popup=1';
142 | }
143 | }
144 |
145 | // build the iframe html
146 | let iframeHTML = '';
147 |
148 | // the modal css class
149 | let iframeInternalModalClass = 'related-modal';
150 |
151 | // if the current window is inside an iframe, it means that it is already in a modal,
152 | // append an additional css class to the modal to offer more customization
153 | if (window.top !== window.self) {
154 | iframeInternalModalClass += ' related-modal__nested';
155 | }
156 |
157 | // open the modal using dynamic bootstrap modal
158 | showModal(modalTitle, iframeHTML, e);
159 |
160 | return false;
161 | }
162 |
163 | // listen click events on related links
164 | function presentRelatedObjectModalOnClickOn(selector, lookup) {
165 | let el = $(selector);
166 | el.removeAttr('onclick');
167 | el.unbind('click');
168 | el.click({lookup: lookup}, presentRelatedObjectModal);
169 | }
170 |
171 | function init() {
172 | presentRelatedObjectModalOnClickOn('a.related-widget-wrapper-link', false);
173 |
174 | // raw_id_fields support
175 | presentRelatedObjectModalOnClickOn('a.related-lookup', true);
176 |
177 | // django-dynamic-raw-id support - #61
178 | // https://github.com/lincolnloop/django-dynamic-raw-id
179 | presentRelatedObjectModalOnClickOn('a.dynamic_raw_id-related-lookup', true);
180 | }
181 |
182 | $(document).ready(function(){
183 | init()
184 | });
185 |
186 | django.jQuery(document).on('formset:added', init);
187 |
188 | })(jQuery);
189 |
--------------------------------------------------------------------------------