diff --git a/trydjango/src/trydjango/__pycache__/0001_initial.py b/trydjango/src/trydjango/__pycache__/0001_initial.py new file mode 100644 index 0000000000..e0e9159798 --- /dev/null +++ b/trydjango/src/trydjango/__pycache__/0001_initial.py @@ -0,0 +1,21 @@ +from django.db import migrations, models # type: ignore + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.Autofield(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.TextField()), + ('description', models.TextField()) + ('price', models.TextField()), + + ], + ), + ] \ No newline at end of file diff --git a/trydjango/src/trydjango/__pycache__/__init__.py b/trydjango/src/trydjango/__pycache__/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/trydjango/src/trydjango/__pycache__/settings.py b/trydjango/src/trydjango/__pycache__/settings.py new file mode 100644 index 0000000000..20cd81745d --- /dev/null +++ b/trydjango/src/trydjango/__pycache__/settings.py @@ -0,0 +1,86 @@ +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +SECRET_KEY = 'fiojaeiwfoioaewfawfw@joijo' + +DEBUG = True + +ALLOWED_HOSTS = [] + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + # Add your apps here + 'products', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'trydjango.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'trydjango.wsgi.application' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + +STATIC_URL = '/static/' + +# Add any additional settings below \ No newline at end of file diff --git a/trydjango/src/trydjango/__pycache__/urls.py b/trydjango/src/trydjango/__pycache__/urls.py new file mode 100644 index 0000000000..397a8c8bf5 --- /dev/null +++ b/trydjango/src/trydjango/__pycache__/urls.py @@ -0,0 +1,9 @@ +from django.contrib import admin # type: ignore +from django.urls import path # type: ignore +from pages import home_view # type: ignore + +urlpatterns = [ + path('', home_view, name='home'), + path('admin/', admin.site.urls), + +] \ No newline at end of file diff --git a/trydjango/src/trydjango/__pycache__/wsgi.py b/trydjango/src/trydjango/__pycache__/wsgi.py new file mode 100644 index 0000000000..8cd5d3f5bd --- /dev/null +++ b/trydjango/src/trydjango/__pycache__/wsgi.py @@ -0,0 +1,6 @@ +import os +from django.core.wsgi import get_wsgi_application # type: ignore + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project_name.settings') + +application = get_wsgi_application() \ No newline at end of file diff --git a/trydjango/src/trydjango/manage.py b/trydjango/src/trydjango/manage.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/trydjango/src/trydjango/migrations/admin.py b/trydjango/src/trydjango/migrations/admin.py new file mode 100644 index 0000000000..8d40389999 --- /dev/null +++ b/trydjango/src/trydjango/migrations/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin # type: ignore + +from models import Product + +admin.state.register(Product) \ No newline at end of file diff --git a/trydjango/src/trydjango/migrations/apps.py b/trydjango/src/trydjango/migrations/apps.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/trydjango/src/trydjango/migrations/models.py b/trydjango/src/trydjango/migrations/models.py new file mode 100644 index 0000000000..26d5677bf2 --- /dev/null +++ b/trydjango/src/trydjango/migrations/models.py @@ -0,0 +1,10 @@ +from django db import models # type: ignore + +class Product(models.Model): + title = models.TextField(max_length=120) #max_length = required + description = models.TextField(blank=True, null=True) + price = models.DecimalField(decimal_places=2, max_digits=10000) + summary = models.TextField(default='this is cool') + featured = models.BooleanField() # null=True, default=True + + diff --git a/trydjango/src/trydjango/migrations/tests.py b/trydjango/src/trydjango/migrations/tests.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/trydjango/src/trydjango/migrations/views.py b/trydjango/src/trydjango/migrations/views.py new file mode 100644 index 0000000000..a62cf8e155 --- /dev/null +++ b/trydjango/src/trydjango/migrations/views.py @@ -0,0 +1,5 @@ +from django.http import HttpResponse # type: ignore +from django.shortcuts import render # type: ignore + +def home_view(*args, **kwargs): + return HttpResponse("h1>Hello World")