├── blog ├── __init__.py ├── __pycache__ │ ├── urls.cpython-37.pyc │ ├── wsgi.cpython-37.pyc │ ├── __init__.cpython-37.pyc │ └── settings.cpython-37.pyc ├── urls.py ├── asgi.py ├── wsgi.py └── settings.py ├── core ├── __init__.py ├── migrations │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── 0001_initial.cpython-37.pyc │ │ └── 0002_osimlik.cpython-37.pyc │ ├── 0002_osimlik.py │ └── 0001_initial.py ├── tests.py ├── __pycache__ │ ├── apps.cpython-37.pyc │ ├── urls.cpython-37.pyc │ ├── admin.cpython-37.pyc │ ├── models.cpython-37.pyc │ ├── views.cpython-37.pyc │ └── __init__.cpython-37.pyc ├── admin.py ├── urls.py ├── apps.py ├── views.py └── models.py ├── db.sqlite3 ├── manage.py └── frontend └── index.html /blog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/db.sqlite3 -------------------------------------------------------------------------------- /core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /blog/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/blog/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/blog/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /core/__pycache__/apps.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/__pycache__/apps.cpython-37.pyc -------------------------------------------------------------------------------- /core/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /core/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /core/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /core/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import * 3 | 4 | admin.site.register((Gul, Rang, Osimlik)) 5 | 6 | 7 | -------------------------------------------------------------------------------- /blog/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/blog/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/blog/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /core/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /core/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import HomeView 3 | 4 | urlpatterns = [ 5 | path('',HomeView.as_view()) 6 | ] 7 | -------------------------------------------------------------------------------- /core/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /core/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /core/migrations/__pycache__/0002_osimlik.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahnozahaydarova/Django/HEAD/core/migrations/__pycache__/0002_osimlik.cpython-37.pyc -------------------------------------------------------------------------------- /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/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views.generic import TemplateView 3 | 4 | class HomeView(TemplateView): 5 | template_name = 'index.html' 6 | -------------------------------------------------------------------------------- /blog/urls.py: -------------------------------------------------------------------------------- 1 | 2 | from django.contrib import admin 3 | from django.urls import path,include 4 | 5 | urlpatterns = [ 6 | path('admin/', admin.site.urls), 7 | path('',include('core.urls')) 8 | ] 9 | -------------------------------------------------------------------------------- /blog/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for blog 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/3.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', 'blog.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /blog/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for blog 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/3.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', 'blog.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /core/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | class Rang(models.Model): 4 | nomi = models.CharField(max_length=20) 5 | 6 | def __str__(self) -> str: 7 | return self.nomi 8 | 9 | class Gul(models.Model): 10 | nomi = models.CharField(max_length=20) 11 | rangi = models.ForeignKey(Rang, on_delete=models.SET_NULL, null=True) 12 | 13 | def __str__(self) -> str: 14 | return self.nomi 15 | 16 | class Osimlik(models.Model): 17 | nomi = models.CharField(max_length=20) 18 | rangi = models.ForeignKey(Rang, on_delete=models.CASCADE) 19 | 20 | def __str__(self) -> str: 21 | return self.nomi -------------------------------------------------------------------------------- /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', 'blog.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 | -------------------------------------------------------------------------------- /core/migrations/0002_osimlik.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.16 on 2022-12-14 14:43 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('core', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Osimlik', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('nomi', models.CharField(max_length=20)), 19 | ('rangi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.rang')), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /core/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.16 on 2022-12-14 14:34 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Rang', 17 | fields=[ 18 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('nomi', models.CharField(max_length=20)), 20 | ], 21 | ), 22 | migrations.CreateModel( 23 | name='Gul', 24 | fields=[ 25 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 26 | ('nomi', models.CharField(max_length=20)), 27 | ('rangi', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.rang')), 28 | ], 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 20 | 21 | {% if 5 < 6 %} 22 |
23 |

To'gri kiritilgan shart

24 | 25 |
26 | {% else %} 27 |
28 |

Noto'gri kiritilgan shart

29 | 30 |
31 | {% endif %} 32 | 33 | -------------------------------------------------------------------------------- /blog/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for blog project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.2.16. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.2/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-t5ufld_m=0d2#=w8+@u-_mipgy)^a6dg94(5kd6+1%fx_^rx05' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'core' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'blog.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [BASE_DIR / 'frontend'], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'blog.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/3.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | # Default primary key field type 124 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field 125 | 126 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 127 | --------------------------------------------------------------------------------