From 0be2fe15c2cd49f8ed32f0a0d36808307b2a9672 Mon Sep 17 00:00:00 2001 From: antoliny0919 Date: Tue, 2 Dec 2025 10:28:54 +0900 Subject: [PATCH 01/14] build: Add django_widget_tweaks --- djangosnippets/settings/base.py | 1 + pyproject.toml | 1 + uv.lock | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/djangosnippets/settings/base.py b/djangosnippets/settings/base.py index c6fd5ccc..767d5820 100644 --- a/djangosnippets/settings/base.py +++ b/djangosnippets/settings/base.py @@ -74,6 +74,7 @@ def user_url(user): "django_components", "rest_framework", "django_htmx", + "widget_tweaks", ] MIDDLEWARE = ( diff --git a/pyproject.toml b/pyproject.toml index c2d8144d..17618425 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ dependencies = [ "sentry-sdk", "gevent", "greenlet", + "django-widget-tweaks>=1.5.0", ] [project.optional-dependencies] diff --git a/uv.lock b/uv.lock index 027557fe..3c8e35ff 100644 --- a/uv.lock +++ b/uv.lock @@ -343,6 +343,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cd/8f/7a651007ab9bf552221ae8adc9305c7d21113a9814eb38153b5fdb4ef5eb/django_tailwind-4.0.1-py3-none-any.whl", hash = "sha256:33e5dd5aadd5aa6facf4bddab9144a40cb501e486d4970b93e2853dbdbef4f67", size = 16714, upload-time = "2025-04-02T20:04:03.038Z" }, ] +[[package]] +name = "django-widget-tweaks" +version = "1.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a5/fe/26eb92fba83844e71bbec0ced7fc2e843e5990020e3cc676925204031654/django-widget-tweaks-1.5.0.tar.gz", hash = "sha256:1c2180681ebb994e922c754804c7ffebbe1245014777ac47897a81f57cc629c7", size = 14767, upload-time = "2023-08-25T15:29:12.778Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/46/6a/6cb6deb5c38b785c77c3ba66f53051eada49205979c407323eb666930915/django_widget_tweaks-1.5.0-py3-none-any.whl", hash = "sha256:a41b7b2f05bd44d673d11ebd6c09a96f1d013ee98121cb98c384fe84e33b881e", size = 8960, upload-time = "2023-08-25T15:29:05.644Z" }, +] + [[package]] name = "djangorestframework" version = "3.15.2" @@ -374,6 +383,7 @@ dependencies = [ { name = "django-redis-cache" }, { name = "django-taggit" }, { name = "django-tailwind" }, + { name = "django-widget-tweaks" }, { name = "djangorestframework" }, { name = "gevent" }, { name = "greenlet" }, @@ -421,6 +431,7 @@ requires-dist = [ { name = "django-redis-cache" }, { name = "django-taggit" }, { name = "django-tailwind" }, + { name = "django-widget-tweaks", specifier = ">=1.5.0" }, { name = "djangorestframework" }, { name = "gevent" }, { name = "greenlet" }, From 9bcf33c22d0d36650d576d48c197c8137d5f16ef Mon Sep 17 00:00:00 2001 From: antoliny0919 Date: Tue, 2 Dec 2025 10:30:38 +0900 Subject: [PATCH 02/14] feat: Add optional header/footer override to base template --- djangosnippets/templates/base.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/djangosnippets/templates/base.html b/djangosnippets/templates/base.html index d5bb0674..acac3447 100644 --- a/djangosnippets/templates/base.html +++ b/djangosnippets/templates/base.html @@ -15,6 +15,7 @@ {% tailwind_css %} + {% block header %}

{% url 'account_logout' as logout_url %} @@ -38,6 +39,7 @@

+ {% endblock %}
{% block secondary_nav %}
+ {% block footer %} + {% endblock %} {% block extra_body %}{% endblock %} From ceec64c9aa92824576fd2247de84e7e9de2d8b39 Mon Sep 17 00:00:00 2001 From: antoliny0919 Date: Tue, 2 Dec 2025 10:31:22 +0900 Subject: [PATCH 03/14] feat: Redesign sign in page --- djangosnippets/templates/account/login.html | 73 ++++++++----------- .../socialaccount/snippets/provider_list.html | 4 +- theme/static_src/src/styles.css | 2 + 3 files changed, 35 insertions(+), 44 deletions(-) diff --git a/djangosnippets/templates/account/login.html b/djangosnippets/templates/account/login.html index 9491bff0..16967c8f 100644 --- a/djangosnippets/templates/account/login.html +++ b/djangosnippets/templates/account/login.html @@ -1,48 +1,37 @@ -{% extends "account/base.html" %} +{% extends "base.html" %} -{% load i18n %} -{% load account %} -{% load socialaccount %} +{% load static account socialaccount widget_tweaks %} -{% block head_title %}{% trans "Login" %}{% endblock %} - -{% block content_header %}{% trans "Login" %}{% endblock %} +{% block header%}{% endblock %} {% block content %} -

-Please log in with one of the following 3rd party systems or with your existing account. -

- -
    - {% include "socialaccount/snippets/provider_list.html" with process="login" %} -
- -{% include "socialaccount/snippets/login_extra.html" %} -{% endblock %} - -{% block sidebar %} - {% endblock %} {% block footer %}{% endblock %} diff --git a/djangosnippets/urls.py b/djangosnippets/urls.py index 43d6228a..bff4113d 100644 --- a/djangosnippets/urls.py +++ b/djangosnippets/urls.py @@ -2,8 +2,6 @@ from django.shortcuts import render from django.urls import include, path -from base.views import DjangoSnippetsEmailVerificationSentView - admin.autodiscover() @@ -13,7 +11,6 @@ def trigger_sentry_error(request): urlpatterns = [ path("sentry-debug/", trigger_sentry_error), - path("accounts/confirm-email/", DjangoSnippetsEmailVerificationSentView.as_view(), name="account_email_verification_sent"), path("accounts/", include("allauth.urls")), path("manage/", admin.site.urls), path("components/", include("django_components.urls")), diff --git a/pyproject.toml b/pyproject.toml index 17618425..9df1422f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ dependencies = [ "markdown", "pillow", "psycopg2-binary", - "pydantic", + "pydantic[email]", "pygments", "python-akismet", "python-dotenv", diff --git a/uv.lock b/uv.lock index 3c8e35ff..cc942a8c 100644 --- a/uv.lock +++ b/uv.lock @@ -391,7 +391,7 @@ dependencies = [ { name = "markdown" }, { name = "pillow" }, { name = "psycopg2-binary" }, - { name = "pydantic" }, + { name = "pydantic", extra = ["email"] }, { name = "pygments" }, { name = "python-akismet" }, { name = "python-dotenv" }, @@ -441,7 +441,7 @@ requires-dist = [ { name = "pillow" }, { name = "pre-commit", marker = "extra == 'dev'" }, { name = "psycopg2-binary" }, - { name = "pydantic" }, + { name = "pydantic", extras = ["email"] }, { name = "pygments" }, { name = "python-akismet" }, { name = "python-dotenv" }, @@ -529,6 +529,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f2/fd/1f3ca2777adef393c135c9bd45260147a2ee72328cf4804f69ad392bebd5/djc_core_html_parser-1.0.3-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:1c2e86c819e6dc49b8c4c81ed4e7a326d877f0aa884e6c6d3e19ce8d292d2dd3", size = 1221302, upload-time = "2025-10-21T21:04:17.876Z" }, ] +[[package]] +name = "dnspython" +version = "2.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/8c/8b/57666417c0f90f08bcafa776861060426765fdb422eb10212086fb811d26/dnspython-2.8.0.tar.gz", hash = "sha256:181d3c6996452cb1189c4046c61599b84a5a86e099562ffde77d26984ff26d0f", size = 368251, upload-time = "2025-09-07T18:58:00.022Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ba/5a/18ad964b0086c6e62e2e7500f7edc89e3faa45033c71c1893d34eed2b2de/dnspython-2.8.0-py3-none-any.whl", hash = "sha256:01d9bbc4a2d76bf0db7c1f729812ded6d912bd318d3b1cf81d30c0f845dbf3af", size = 331094, upload-time = "2025-09-07T18:57:58.071Z" }, +] + +[[package]] +name = "email-validator" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "dnspython" }, + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f5/22/900cb125c76b7aaa450ce02fd727f452243f2e91a61af068b40adba60ea9/email_validator-2.3.0.tar.gz", hash = "sha256:9fc05c37f2f6cf439ff414f8fc46d917929974a82244c20eb10231ba60c54426", size = 51238, upload-time = "2025-08-26T13:09:06.831Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/de/15/545e2b6cf2e3be84bc1ed85613edd75b8aea69807a71c26f4ca6a9258e82/email_validator-2.3.0-py3-none-any.whl", hash = "sha256:80f13f623413e6b197ae73bb10bf4eb0908faf509ad8362c5edeb0be7fd450b4", size = 35604, upload-time = "2025-08-26T13:09:05.858Z" }, +] + [[package]] name = "filelock" version = "3.20.0" @@ -1042,6 +1064,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6a/c0/ec2b1c8712ca690e5d61979dee872603e92b8a32f94cc1b72d53beab008a/pydantic-2.11.7-py3-none-any.whl", hash = "sha256:dde5df002701f6de26248661f6835bbe296a47bf73990135c7d07ce741b9623b", size = 444782, upload-time = "2025-06-14T08:33:14.905Z" }, ] +[package.optional-dependencies] +email = [ + { name = "email-validator" }, +] + [[package]] name = "pydantic-core" version = "2.33.2"