diff --git a/Makefile b/Makefile
index 6942449..456bafc 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ help:
@perl -nle'print $& if m{^[a-zA-Z_-|.]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
run.format: ## Format style with black
- docker-compose -f docker-compose.dev.yaml exec -T django bash -c "black --exclude='/(postgres|venv|migrations|node_modules|\.git)/' ."
+ docker-compose -f docker-compose.yaml exec -T django bash -c "black --exclude='/(postgres|venv|migrations|node_modules|\.git)/' ."
docker.bash: ## Enter bash terminal
docker exec -it formacion-htmx_django_1 bash
diff --git a/app/website/apps.py b/app/website/apps.py
index b8fd484..f1d93d1 100644
--- a/app/website/apps.py
+++ b/app/website/apps.py
@@ -2,5 +2,5 @@ from django.apps import AppConfig
class WebsiteConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'app.website'
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "app.website"
diff --git a/app/website/models.py b/app/website/models.py
index b478eaa..d1eb733 100644
--- a/app/website/models.py
+++ b/app/website/models.py
@@ -8,9 +8,7 @@ class Profile(AbstractBaseUser):
"""User model"""
email = models.EmailField("Email", unique=True)
- full_name = models.CharField(
- max_length=100, verbose_name="Full name", default=""
- )
+ full_name = models.CharField(max_length=100, verbose_name="Full name", default="")
avatar = models.ImageField(verbose_name="Avatar", upload_to="uploads/avatars/")
USERNAME_FIELD = "email" # make the user log in with the email
diff --git a/app/website/templates/layouts/base.html b/app/website/templates/layouts/base.html
new file mode 100644
index 0000000..e557327
--- /dev/null
+++ b/app/website/templates/layouts/base.html
@@ -0,0 +1,22 @@
+{% load static %}
+
+
+
+
+ htmx demo
+
+
+
+
+
+
+ {# Styles #}
+
+
+ {# JavaScript #}
+
+
+
+ {% block content %}{% endblock %}
+
+
diff --git a/app/website/templates/pages/posts.html b/app/website/templates/pages/posts.html
new file mode 100644
index 0000000..f1ed912
--- /dev/null
+++ b/app/website/templates/pages/posts.html
@@ -0,0 +1,5 @@
+{% extends 'layouts/base.html' %}
+
+{% block content %}
+ Hola
+{% endblock %}
diff --git a/app/website/views.py b/app/website/views.py
index 91ea44a..8438bc8 100644
--- a/app/website/views.py
+++ b/app/website/views.py
@@ -1,3 +1,5 @@
from django.shortcuts import render
-# Create your views here.
+
+def index(request):
+ return render(request, "pages/posts.html")
diff --git a/event/asgi.py b/event/asgi.py
index 0602b7e..8cca061 100644
--- a/event/asgi.py
+++ b/event/asgi.py
@@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'event.settings')
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "event.settings")
application = get_asgi_application()
diff --git a/event/settings.py b/event/settings.py
index 8f91087..06bad84 100644
--- a/event/settings.py
+++ b/event/settings.py
@@ -35,40 +35,40 @@ if not os.environ.get("ALLOWED_HOSTS") == None:
# Application definition
INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'django_extensions',
- 'channels',
- 'app.website',
+ "django.contrib.admin",
+ "django.contrib.auth",
+ "django.contrib.contenttypes",
+ "django.contrib.sessions",
+ "django.contrib.messages",
+ "django.contrib.staticfiles",
+ "django_extensions",
+ "channels",
+ "app.website",
]
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',
+ "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 = 'event.urls'
+ROOT_URLCONF = "event.urls"
TEMPLATES = [
{
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [os.path.join(BASE_DIR, "app", "templates")],
- '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',
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ "DIRS": [os.path.join(BASE_DIR, "app", "templates")],
+ "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",
],
},
},
@@ -94,16 +94,16 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [
{
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
@@ -111,9 +111,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
-LANGUAGE_CODE = 'es-es'
+LANGUAGE_CODE = "es-es"
-TIME_ZONE = 'UTC'
+TIME_ZONE = "UTC"
USE_I18N = True
@@ -153,12 +153,10 @@ CHANNEL_LAYERS = {
}
-
-
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
-DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
if DEBUG:
CACHES = {
diff --git a/event/urls.py b/event/urls.py
index 17f72c2..c026639 100644
--- a/event/urls.py
+++ b/event/urls.py
@@ -15,7 +15,9 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path
+from app.website.views import index
urlpatterns = [
- path('admin/', admin.site.urls),
+ path("", index, name="index"),
+ path("admin/", admin.site.urls),
]
diff --git a/event/wsgi.py b/event/wsgi.py
index e191a6b..a7c0099 100644
--- a/event/wsgi.py
+++ b/event/wsgi.py
@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'event.settings')
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "event.settings")
application = get_wsgi_application()
diff --git a/manage.py b/manage.py
index bdcac66..fb03080 100755
--- a/manage.py
+++ b/manage.py
@@ -6,7 +6,7 @@ import sys
def main():
"""Run administrative tasks."""
- os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'event.settings')
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "event.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv)
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index c08928b..296bdfc 100644
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -1,9 +1,10 @@
from app.website.models import Category
from faker import Faker
+
def run():
fake = Faker()
# 5 categories
for word in [fake.unique.sentence(nb_words=1)[0:-1] for i in range(5)]:
- Category(name=word).save()
\ No newline at end of file
+ Category(name=word).save()
diff --git a/scripts/create_profiles.py b/scripts/create_profiles.py
index ec0fe00..141f13a 100644
--- a/scripts/create_profiles.py
+++ b/scripts/create_profiles.py
@@ -8,6 +8,7 @@ import time
from tempfile import NamedTemporaryFile
from random import randint
+
def run():
fake = Faker()
diff --git a/scripts/create_talks.py b/scripts/create_talks.py
index 500fb5f..8366c38 100644
--- a/scripts/create_talks.py
+++ b/scripts/create_talks.py
@@ -8,17 +8,20 @@ import time
from tempfile import NamedTemporaryFile
from random import randint
+
def run():
fake = Faker()
# 100 talks
- for title in [fake.unique.sentence(nb_words=10)[0:-1] for i in range(100)]:
+ for title in [fake.unique.sentence(nb_words=5)[0:-1] for i in range(100)]:
my_talk = Talk(
title=title,
category=Category.objects.order_by("?")[0],
author=Profile.objects.order_by("?")[0],
is_draft=False,
- content=fake.text(max_nb_chars=1000),
+ content=""
+ + "
".join(fake.paragraph(nb_sentences=randint(5, 10)))
+ + "
",
)
my_talk.save()
@@ -28,4 +31,4 @@ def run():
img_temp = NamedTemporaryFile(delete=True)
img_temp.write(r.content)
img_temp.flush()
- my_talk.image.save(f"random_{int(time.time() * 1000)}.jpg", File(img_temp))
\ No newline at end of file
+ my_talk.image.save(f"random_{int(time.time() * 1000)}.jpg", File(img_temp))