Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added pages/__init__.py
Empty file.
Binary file added pages/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file added pages/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file added pages/__pycache__/apps.cpython-312.pyc
Binary file not shown.
Binary file added pages/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file added pages/__pycache__/views.cpython-312.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions pages/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions pages/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class PagesConfig(AppConfig):
name = 'pages'
Empty file added pages/migrations/__init__.py
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions pages/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions pages/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
6 changes: 6 additions & 0 deletions pages/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
def home_view(*args, **kwargs):
return HttpResponse("<h1>Hello World</h1>")
Empty file added products/__init__.py
Empty file.
Binary file added products/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file added products/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file added products/__pycache__/apps.cpython-312.pyc
Binary file not shown.
Binary file added products/__pycache__/models.cpython-312.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions products/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin

# Register your models here.
from .models import Product

admin.site.register(Product)
5 changes: 5 additions & 0 deletions products/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ProductsConfig(AppConfig):
name = 'products'
24 changes: 24 additions & 0 deletions products/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 6.0.2 on 2026-02-24 00:06

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=120)),
('description', models.TextField(blank=True, null=True)),
('price', models.DecimalField(decimal_places=2, max_digits=10000)),
('summary', models.TextField()),
],
),
]
18 changes: 18 additions & 0 deletions products/migrations/0002_product_featured.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 6.0.2 on 2026-02-24 00:22

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('products', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='product',
name='featured',
field=models.BooleanField(default=False),
),
]
18 changes: 18 additions & 0 deletions products/migrations/0003_alter_product_featured.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 6.0.2 on 2026-02-24 00:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('products', '0002_product_featured'),
]

operations = [
migrations.AlterField(
model_name='product',
name='featured',
field=models.BooleanField(),
),
]
17 changes: 17 additions & 0 deletions products/migrations/0004_remove_product_featured.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 6.0.2 on 2026-02-24 00:23

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('products', '0003_alter_product_featured'),
]

operations = [
migrations.RemoveField(
model_name='product',
name='featured',
),
]
19 changes: 19 additions & 0 deletions products/migrations/0005_product_featured.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 6.0.2 on 2026-02-24 00:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('products', '0004_remove_product_featured'),
]

operations = [
migrations.AddField(
model_name='product',
name='featured',
field=models.BooleanField(default=False),
preserve_default=False,
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 6.0.2 on 2026-02-24 00:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('products', '0005_product_featured'),
]

operations = [
migrations.AlterField(
model_name='product',
name='featured',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='product',
name='summary',
field=models.TextField(blank=True),
),
]
Empty file added products/migrations/__init__.py
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions products/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.db import models

# Create your models here.
# models.Model is the base class for all models in Django. It provides a lot of functionality, such as saving to the database, querying, etc.
# You put this in the paranthesis for inheritance. To tell Django that this is a model, you need to inherit from models.Model.
class Product(models.Model):
title = models.CharField(max_length=120)
description = models.TextField(blank = True, null = True)
price = models.DecimalField(blank = False, decimal_places=2, max_digits=10000)
summary = models.TextField(blank = True)
featured = models.BooleanField(default=False)
3 changes: 3 additions & 0 deletions products/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions products/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
26 changes: 26 additions & 0 deletions trydjango/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""trydjango URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from pages.views import home_view
from pages.views import product_view


urlpatterns = [
path('', home_view, name='home'),
path('products/', product_view, name='products'),
path('admin/', admin.site.urls),
]