Skip to content

Commit 1763d78

Browse files
committed
added example site
1 parent 181529e commit 1763d78

File tree

21 files changed

+444
-0
lines changed

21 files changed

+444
-0
lines changed

example_site/example_site/__init__.py

Whitespace-only changes.

example_site/example_site/asgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for example_site 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.1/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", "example_site.settings")
15+
16+
application = get_asgi_application()
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
"""
2+
Django settings for example_site project.
3+
"""
4+
5+
from pathlib import Path
6+
7+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
8+
BASE_DIR = Path(__file__).resolve().parent.parent
9+
10+
11+
SECRET_KEY = "django-insecure-jr*9(#=_rctq!-cy0hx=l9d&njb0mcnsf)(zm5^64%(=wu8(ec"
12+
13+
14+
DEBUG = True
15+
16+
ALLOWED_HOSTS = []
17+
18+
INSTALLED_APPS = [
19+
"django.contrib.admin",
20+
"django.contrib.auth",
21+
"django.contrib.contenttypes",
22+
"django.contrib.sessions",
23+
"django.contrib.messages",
24+
"django.contrib.staticfiles",
25+
'dynamic_breadcrumbs',
26+
"geography"
27+
]
28+
29+
MIDDLEWARE = [
30+
"django.middleware.security.SecurityMiddleware",
31+
"django.contrib.sessions.middleware.SessionMiddleware",
32+
"django.middleware.common.CommonMiddleware",
33+
"django.middleware.csrf.CsrfViewMiddleware",
34+
"django.contrib.auth.middleware.AuthenticationMiddleware",
35+
"django.contrib.messages.middleware.MessageMiddleware",
36+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
37+
]
38+
39+
ROOT_URLCONF = "example_site.urls"
40+
41+
TEMPLATES = [
42+
{
43+
"BACKEND": "django.template.backends.django.DjangoTemplates",
44+
"DIRS": [],
45+
"APP_DIRS": True,
46+
"OPTIONS": {
47+
"context_processors": [
48+
"django.template.context_processors.debug",
49+
"django.template.context_processors.request",
50+
"django.contrib.auth.context_processors.auth",
51+
"django.contrib.messages.context_processors.messages",
52+
"dynamic_breadcrumbs.context_processors.breadcrumbs",
53+
54+
],
55+
},
56+
},
57+
]
58+
59+
WSGI_APPLICATION = "example_site.wsgi.application"
60+
61+
62+
DATABASES = {
63+
"default": {
64+
"ENGINE": "django.db.backends.sqlite3",
65+
"NAME": BASE_DIR / "db.sqlite3",
66+
}
67+
}
68+
69+
AUTH_PASSWORD_VALIDATORS = [
70+
{
71+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
72+
},
73+
{
74+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
75+
},
76+
{
77+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
78+
},
79+
{
80+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
81+
},
82+
]
83+
84+
85+
# Internationalization
86+
# https://docs.djangoproject.com/en/4.1/topics/i18n/
87+
88+
LANGUAGE_CODE = "en-us"
89+
90+
TIME_ZONE = "UTC"
91+
92+
USE_I18N = True
93+
94+
USE_TZ = True
95+
96+
97+
# Static files (CSS, JavaScript, Images)
98+
# https://docs.djangoproject.com/en/4.1/howto/static-files/
99+
100+
STATIC_URL = "static/"
101+
102+
# Default primary key field type
103+
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
104+
105+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

example_site/example_site/urls.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.contrib import admin
2+
from django.urls import include, path
3+
4+
urlpatterns = [
5+
path("admin/", admin.site.urls),
6+
path("", include("geography.urls")),
7+
]

example_site/example_site/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for example_site 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.1/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", "example_site.settings")
15+
16+
application = get_wsgi_application()

example_site/fixtures.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"model": "admin.logentry", "pk": 1, "fields": {"action_time": "2023-09-20T18:10:47.735Z", "user": 1, "content_type": 7, "object_id": "1", "object_repr": "America", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 2, "fields": {"action_time": "2023-09-20T18:10:55.709Z", "user": 1, "content_type": 7, "object_id": "2", "object_repr": "America", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 3, "fields": {"action_time": "2023-09-20T18:11:23.090Z", "user": 1, "content_type": 7, "object_id": "1", "object_repr": "America", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 4, "fields": {"action_time": "2023-09-20T18:11:41.906Z", "user": 1, "content_type": 7, "object_id": "3", "object_repr": "Europe", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 5, "fields": {"action_time": "2023-09-20T18:12:07.244Z", "user": 1, "content_type": 8, "object_id": "1", "object_repr": "Italy", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 6, "fields": {"action_time": "2023-09-20T18:12:19.540Z", "user": 1, "content_type": 8, "object_id": "2", "object_repr": "Uruguay", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 7, "fields": {"action_time": "2023-09-20T18:12:33.730Z", "user": 1, "content_type": 9, "object_id": "1", "object_repr": "Montevideo", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 8, "fields": {"action_time": "2023-09-20T18:12:45.080Z", "user": 1, "content_type": 9, "object_id": "2", "object_repr": "Rome", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "auth.permission", "pk": 1, "fields": {"name": "Can add log entry", "content_type": 1, "codename": "add_logentry"}}, {"model": "auth.permission", "pk": 2, "fields": {"name": "Can change log entry", "content_type": 1, "codename": "change_logentry"}}, {"model": "auth.permission", "pk": 3, "fields": {"name": "Can delete log entry", "content_type": 1, "codename": "delete_logentry"}}, {"model": "auth.permission", "pk": 4, "fields": {"name": "Can view log entry", "content_type": 1, "codename": "view_logentry"}}, {"model": "auth.permission", "pk": 5, "fields": {"name": "Can add permission", "content_type": 2, "codename": "add_permission"}}, {"model": "auth.permission", "pk": 6, "fields": {"name": "Can change permission", "content_type": 2, "codename": "change_permission"}}, {"model": "auth.permission", "pk": 7, "fields": {"name": "Can delete permission", "content_type": 2, "codename": "delete_permission"}}, {"model": "auth.permission", "pk": 8, "fields": {"name": "Can view permission", "content_type": 2, "codename": "view_permission"}}, {"model": "auth.permission", "pk": 9, "fields": {"name": "Can add group", "content_type": 3, "codename": "add_group"}}, {"model": "auth.permission", "pk": 10, "fields": {"name": "Can change group", "content_type": 3, "codename": "change_group"}}, {"model": "auth.permission", "pk": 11, "fields": {"name": "Can delete group", "content_type": 3, "codename": "delete_group"}}, {"model": "auth.permission", "pk": 12, "fields": {"name": "Can view group", "content_type": 3, "codename": "view_group"}}, {"model": "auth.permission", "pk": 13, "fields": {"name": "Can add user", "content_type": 4, "codename": "add_user"}}, {"model": "auth.permission", "pk": 14, "fields": {"name": "Can change user", "content_type": 4, "codename": "change_user"}}, {"model": "auth.permission", "pk": 15, "fields": {"name": "Can delete user", "content_type": 4, "codename": "delete_user"}}, {"model": "auth.permission", "pk": 16, "fields": {"name": "Can view user", "content_type": 4, "codename": "view_user"}}, {"model": "auth.permission", "pk": 17, "fields": {"name": "Can add content type", "content_type": 5, "codename": "add_contenttype"}}, {"model": "auth.permission", "pk": 18, "fields": {"name": "Can change content type", "content_type": 5, "codename": "change_contenttype"}}, {"model": "auth.permission", "pk": 19, "fields": {"name": "Can delete content type", "content_type": 5, "codename": "delete_contenttype"}}, {"model": "auth.permission", "pk": 20, "fields": {"name": "Can view content type", "content_type": 5, "codename": "view_contenttype"}}, {"model": "auth.permission", "pk": 21, "fields": {"name": "Can add session", "content_type": 6, "codename": "add_session"}}, {"model": "auth.permission", "pk": 22, "fields": {"name": "Can change session", "content_type": 6, "codename": "change_session"}}, {"model": "auth.permission", "pk": 23, "fields": {"name": "Can delete session", "content_type": 6, "codename": "delete_session"}}, {"model": "auth.permission", "pk": 24, "fields": {"name": "Can view session", "content_type": 6, "codename": "view_session"}}, {"model": "auth.permission", "pk": 25, "fields": {"name": "Can add continent", "content_type": 7, "codename": "add_continent"}}, {"model": "auth.permission", "pk": 26, "fields": {"name": "Can change continent", "content_type": 7, "codename": "change_continent"}}, {"model": "auth.permission", "pk": 27, "fields": {"name": "Can delete continent", "content_type": 7, "codename": "delete_continent"}}, {"model": "auth.permission", "pk": 28, "fields": {"name": "Can view continent", "content_type": 7, "codename": "view_continent"}}, {"model": "auth.permission", "pk": 29, "fields": {"name": "Can add country", "content_type": 8, "codename": "add_country"}}, {"model": "auth.permission", "pk": 30, "fields": {"name": "Can change country", "content_type": 8, "codename": "change_country"}}, {"model": "auth.permission", "pk": 31, "fields": {"name": "Can delete country", "content_type": 8, "codename": "delete_country"}}, {"model": "auth.permission", "pk": 32, "fields": {"name": "Can view country", "content_type": 8, "codename": "view_country"}}, {"model": "auth.permission", "pk": 33, "fields": {"name": "Can add city", "content_type": 9, "codename": "add_city"}}, {"model": "auth.permission", "pk": 34, "fields": {"name": "Can change city", "content_type": 9, "codename": "change_city"}}, {"model": "auth.permission", "pk": 35, "fields": {"name": "Can delete city", "content_type": 9, "codename": "delete_city"}}, {"model": "auth.permission", "pk": 36, "fields": {"name": "Can view city", "content_type": 9, "codename": "view_city"}}, {"model": "auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$390000$nQvU7SLZ8fdpelVZ8Wkifk$sPQagnlLRlABf4jGeK3M6hjL2aimdRSC+zUTV2x8zTI=", "last_login": "2023-09-20T18:10:32.140Z", "is_superuser": true, "username": "admin", "first_name": "", "last_name": "", "email": "admin@example.com", "is_staff": true, "is_active": true, "date_joined": "2023-09-20T18:10:12.329Z", "groups": [], "user_permissions": []}}, {"model": "contenttypes.contenttype", "pk": 1, "fields": {"app_label": "admin", "model": "logentry"}}, {"model": "contenttypes.contenttype", "pk": 2, "fields": {"app_label": "auth", "model": "permission"}}, {"model": "contenttypes.contenttype", "pk": 3, "fields": {"app_label": "auth", "model": "group"}}, {"model": "contenttypes.contenttype", "pk": 4, "fields": {"app_label": "auth", "model": "user"}}, {"model": "contenttypes.contenttype", "pk": 5, "fields": {"app_label": "contenttypes", "model": "contenttype"}}, {"model": "contenttypes.contenttype", "pk": 6, "fields": {"app_label": "sessions", "model": "session"}}, {"model": "contenttypes.contenttype", "pk": 7, "fields": {"app_label": "geography", "model": "continent"}}, {"model": "contenttypes.contenttype", "pk": 8, "fields": {"app_label": "geography", "model": "country"}}, {"model": "contenttypes.contenttype", "pk": 9, "fields": {"app_label": "geography", "model": "city"}}, {"model": "sessions.session", "pk": "lm5z29b9ic9zfbcn7v1myuvjhofinrbz", "fields": {"session_data": ".eJxVjMsOwiAUBf-FtSFcwsO4dO83kAsHpGogKe2q8d-1SRe6PTNzNhF4XWpYR57DBHERJE6_W-T0zG0HeHC7d5l6W-Ypyl2RBx3y1pFf18P9O6g86rfO7F3MQCHSmlViaI94Vp5syS4Z5SyKVh6FqXgYAlFK1sGxgjdOvD8NIjin:1qj1ei:6IXTpMbuXTcnwtmTmb_CmLizI4I08JcslGY7cyuqQd4", "expire_date": "2023-10-04T18:10:32.151Z"}}, {"model": "geography.continent", "pk": 2, "fields": {"name": "America", "slug": "america"}}, {"model": "geography.continent", "pk": 3, "fields": {"name": "Europe", "slug": "europe"}}, {"model": "geography.country", "pk": 1, "fields": {"name": "Italy", "slug": "italy", "continent": 3}}, {"model": "geography.country", "pk": 2, "fields": {"name": "Uruguay", "slug": "uruguay", "continent": 2}}, {"model": "geography.city", "pk": 1, "fields": {"name": "Montevideo", "slug": "montevideo", "country": 2}}, {"model": "geography.city", "pk": 2, "fields": {"name": "Rome", "slug": "rome", "country": 1}}]

example_site/geography/__init__.py

Whitespace-only changes.

example_site/geography/admin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from django.contrib import admin
2+
from geography.models import Continent, Country, City
3+
4+
5+
class ContinentAdmin(admin.ModelAdmin):
6+
pass
7+
8+
class CountryAdmin(admin.ModelAdmin):
9+
pass
10+
11+
class CityAdmin(admin.ModelAdmin):
12+
pass
13+
14+
15+
admin.site.register(Continent, ContinentAdmin)
16+
admin.site.register(Country, CountryAdmin)
17+
admin.site.register(City, CityAdmin)

example_site/geography/apps.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class GeographyConfig(AppConfig):
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "geography"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Generated by Django 4.1.3 on 2023-09-20 18:09
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+
operations = [
14+
migrations.CreateModel(
15+
name="Continent",
16+
fields=[
17+
(
18+
"id",
19+
models.BigAutoField(
20+
auto_created=True,
21+
primary_key=True,
22+
serialize=False,
23+
verbose_name="ID",
24+
),
25+
),
26+
("name", models.CharField(max_length=100)),
27+
("slug", models.SlugField(default="", max_length=100)),
28+
],
29+
options={
30+
"abstract": False,
31+
},
32+
),
33+
migrations.CreateModel(
34+
name="Country",
35+
fields=[
36+
(
37+
"id",
38+
models.BigAutoField(
39+
auto_created=True,
40+
primary_key=True,
41+
serialize=False,
42+
verbose_name="ID",
43+
),
44+
),
45+
("name", models.CharField(max_length=100)),
46+
("slug", models.SlugField(default="", max_length=100)),
47+
(
48+
"continent",
49+
models.ForeignKey(
50+
on_delete=django.db.models.deletion.CASCADE,
51+
to="geography.continent",
52+
),
53+
),
54+
],
55+
options={
56+
"abstract": False,
57+
},
58+
),
59+
migrations.CreateModel(
60+
name="City",
61+
fields=[
62+
(
63+
"id",
64+
models.BigAutoField(
65+
auto_created=True,
66+
primary_key=True,
67+
serialize=False,
68+
verbose_name="ID",
69+
),
70+
),
71+
("name", models.CharField(max_length=100)),
72+
("slug", models.SlugField(default="", max_length=100)),
73+
(
74+
"country",
75+
models.ForeignKey(
76+
on_delete=django.db.models.deletion.CASCADE,
77+
to="geography.country",
78+
),
79+
),
80+
],
81+
options={
82+
"abstract": False,
83+
},
84+
),
85+
]

0 commit comments

Comments
 (0)