├── README.md ├── chart ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── settings.cpython-310.pyc │ ├── urls.cpython-310.pyc │ └── wsgi.cpython-310.pyc ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py ├── core ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── admin.cpython-310.pyc │ ├── apps.cpython-310.pyc │ ├── models.cpython-310.pyc │ ├── urls.cpython-310.pyc │ └── views.cpython-310.pyc ├── admin.py ├── apps.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_post_mazmuni.py │ ├── 0003_alter_post_options_remove_post_mazmuni_post_daromadi.py │ ├── __init__.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-310.pyc │ │ ├── 0002_post_mazmuni.cpython-310.pyc │ │ ├── 0003_alter_post_options_remove_post_mazmuni_post_daromadi.cpython-310.pyc │ │ └── __init__.cpython-310.pyc ├── models.py ├── templates │ └── core │ │ └── fayl.html ├── tests.py ├── urls.py └── views.py ├── db.sqlite3 ├── frontend ├── details │ └── menu.html ├── examp.html └── index.html ├── manage.py └── requirements.txt /README.md: -------------------------------------------------------------------------------- 1 | Django & Chart.js -------------------------------------------------------------------------------- /chart/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/chart/__init__.py -------------------------------------------------------------------------------- /chart/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/chart/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /chart/__pycache__/settings.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/chart/__pycache__/settings.cpython-310.pyc -------------------------------------------------------------------------------- /chart/__pycache__/urls.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/chart/__pycache__/urls.cpython-310.pyc -------------------------------------------------------------------------------- /chart/__pycache__/wsgi.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/chart/__pycache__/wsgi.cpython-310.pyc -------------------------------------------------------------------------------- /chart/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for chart 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.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chart.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chart/settings.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 4 | BASE_DIR = Path(__file__).resolve().parent.parent 5 | 6 | 7 | # Quick-start development settings - unsuitable for production 8 | # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ 9 | 10 | # SECURITY WARNING: keep the secret key used in production secret! 11 | SECRET_KEY = 'django-insecure-#1pdq71g4#w2!#qxulq8)nhybdi4qbu1g7ye89rf@3&3u=rae=' 12 | 13 | # SECURITY WARNING: don't run with debug turned on in production! 14 | DEBUG = True 15 | 16 | ALLOWED_HOSTS = [] 17 | 18 | 19 | # Application definition 20 | 21 | INSTALLED_APPS = [ 22 | 'django.contrib.admin', 23 | 'django.contrib.auth', 24 | 'django.contrib.contenttypes', 25 | 'django.contrib.sessions', 26 | 'django.contrib.messages', 27 | 'django.contrib.staticfiles', 28 | 29 | 'core' 30 | ] 31 | 32 | MIDDLEWARE = [ 33 | 'django.middleware.security.SecurityMiddleware', 34 | 'django.contrib.sessions.middleware.SessionMiddleware', 35 | 'django.middleware.common.CommonMiddleware', 36 | 'django.middleware.csrf.CsrfViewMiddleware', 37 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 38 | 'django.contrib.messages.middleware.MessageMiddleware', 39 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 40 | ] 41 | 42 | ROOT_URLCONF = 'chart.urls' 43 | 44 | TEMPLATES = [ 45 | { 46 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 47 | 'DIRS': [ BASE_DIR / "frontend" ], 48 | 'APP_DIRS': True, 49 | 'OPTIONS': { 50 | 'context_processors': [ 51 | 'django.template.context_processors.debug', 52 | 'django.template.context_processors.request', 53 | 'django.contrib.auth.context_processors.auth', 54 | 'django.contrib.messages.context_processors.messages', 55 | ], 56 | }, 57 | }, 58 | ] 59 | 60 | WSGI_APPLICATION = 'chart.wsgi.application' 61 | 62 | 63 | # Database 64 | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases 65 | 66 | DATABASES = { 67 | 'default': { 68 | 'ENGINE': 'django.db.backends.sqlite3', 69 | 'NAME': BASE_DIR / 'db.sqlite3', 70 | } 71 | } 72 | 73 | 74 | # Password validation 75 | # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators 76 | 77 | AUTH_PASSWORD_VALIDATORS = [ 78 | { 79 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 80 | }, 81 | { 82 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 83 | }, 84 | { 85 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 86 | }, 87 | { 88 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 89 | }, 90 | ] 91 | 92 | 93 | # Internationalization 94 | # https://docs.djangoproject.com/en/4.0/topics/i18n/ 95 | 96 | LANGUAGE_CODE = 'en-us' 97 | 98 | TIME_ZONE = 'UTC' 99 | 100 | USE_I18N = True 101 | 102 | USE_TZ = True 103 | 104 | 105 | # Static files (CSS, JavaScript, Images) 106 | # https://docs.djangoproject.com/en/4.0/howto/static-files/ 107 | 108 | STATIC_URL = 'static/' 109 | 110 | # Default primary key field type 111 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field 112 | 113 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 114 | -------------------------------------------------------------------------------- /chart/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | 4 | urlpatterns = [ 5 | path('admin/', admin.site.urls), 6 | path('', include('core.urls')) 7 | ] 8 | -------------------------------------------------------------------------------- /chart/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for chart 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.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chart.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__init__.py -------------------------------------------------------------------------------- /core/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /core/__pycache__/admin.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__pycache__/admin.cpython-310.pyc -------------------------------------------------------------------------------- /core/__pycache__/apps.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__pycache__/apps.cpython-310.pyc -------------------------------------------------------------------------------- /core/__pycache__/models.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__pycache__/models.cpython-310.pyc -------------------------------------------------------------------------------- /core/__pycache__/urls.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__pycache__/urls.cpython-310.pyc -------------------------------------------------------------------------------- /core/__pycache__/views.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/__pycache__/views.cpython-310.pyc -------------------------------------------------------------------------------- /core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post 3 | 4 | admin.site.register(Post) 5 | -------------------------------------------------------------------------------- /core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'core' 7 | -------------------------------------------------------------------------------- /core/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0 on 2022-03-25 23:09 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Post', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('nomi', models.CharField(max_length=50)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /core/migrations/0002_post_mazmuni.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0 on 2022-03-26 10:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='post', 15 | name='mazmuni', 16 | field=models.TextField(default=12), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /core/migrations/0003_alter_post_options_remove_post_mazmuni_post_daromadi.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0 on 2022-03-27 10:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0002_post_mazmuni'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='post', 15 | options={'verbose_name': 'Post', 'verbose_name_plural': 'Postlar'}, 16 | ), 17 | migrations.RemoveField( 18 | model_name='post', 19 | name='mazmuni', 20 | ), 21 | migrations.AddField( 22 | model_name='post', 23 | name='daromadi', 24 | field=models.IntegerField(default=1), 25 | preserve_default=False, 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /core/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/migrations/__init__.py -------------------------------------------------------------------------------- /core/migrations/__pycache__/0001_initial.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/migrations/__pycache__/0001_initial.cpython-310.pyc -------------------------------------------------------------------------------- /core/migrations/__pycache__/0002_post_mazmuni.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/migrations/__pycache__/0002_post_mazmuni.cpython-310.pyc -------------------------------------------------------------------------------- /core/migrations/__pycache__/0003_alter_post_options_remove_post_mazmuni_post_daromadi.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/migrations/__pycache__/0003_alter_post_options_remove_post_mazmuni_post_daromadi.cpython-310.pyc -------------------------------------------------------------------------------- /core/migrations/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/migrations/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /core/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | class Post(models.Model): 5 | class Meta: 6 | verbose_name = "Post" 7 | verbose_name_plural = "Postlar" 8 | 9 | nomi = models.CharField(max_length=50) 10 | daromadi = models.IntegerField() 11 | 12 | def __str__(self): 13 | return self.nomi 14 | 15 | -------------------------------------------------------------------------------- /core/templates/core/fayl.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/core/templates/core/fayl.html -------------------------------------------------------------------------------- /core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /core/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import * 3 | 4 | urlpatterns = [ 5 | path('', home), 6 | path('example/', example) 7 | ] 8 | -------------------------------------------------------------------------------- /core/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from .models import Post 3 | 4 | def home(request): 5 | posts = Post.objects.all() 6 | context = { 7 | 'posts': posts 8 | } 9 | return render(request, 'index.html', context) 10 | 11 | def example(request): 12 | posts = Post.objects.all() 13 | context = { 14 | 'posts': posts 15 | } 16 | return render(request, 'examp.html', context) -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/db.sqlite3 -------------------------------------------------------------------------------- /frontend/details/menu.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/examp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | {% include 'details/menu.html' %} 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {% include 'details/menu.html' %} 22 | 23 | 24 | 25 |
26 | 27 |
28 | 29 | 30 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /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', 'chart.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 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/susys-chart-django-course/4a4735d9ad82bf48b606e6cfb25e1dc21e96e9e4/requirements.txt --------------------------------------------------------------------------------