diff --git a/.gitignore b/.gitignore index a4b82db05af62f9fe6f184978d4de424e1b8d712..bb6570f2df286269073b5da5a7ee7d9a57fbcd6f 100644 --- a/.gitignore +++ b/.gitignore @@ -145,9 +145,12 @@ cython_debug/ **/db.sqlite3 /db/db.sqlite3 /staticfiles/ +/static/core/css/output.css +**/node_modules/ + # Apps wedding/ wishlist/ trips/ -/static/core/css/output.css +thw/ diff --git a/core/settings.py b/core/settings.py index 912e93d6d3226c15a82756cb816c190544a8e309..2425f8b8d63f607dfa8955974cc75bf6bf890642 100644 --- a/core/settings.py +++ b/core/settings.py @@ -9,6 +9,7 @@ https://docs.djangoproject.com/en/4.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.1/ref/settings/ """ + from os import environ from pathlib import Path @@ -40,7 +41,8 @@ INSTALLED_APPS = [ "whitenoise.runserver_nostatic", "django.contrib.staticfiles", "django.contrib.humanize", - "{{app_to_install}}", + "django.forms", + "thw", ] MIDDLEWARE = [ @@ -56,6 +58,7 @@ MIDDLEWARE = [ ROOT_URLCONF = "core.urls" +FORM_RENDERER = "django.forms.renderers.TemplatesSetting" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", @@ -117,7 +120,10 @@ USE_TZ = True # https://docs.djangoproject.com/en/4.1/howto/static-files/ STATIC_URL = "static/" -STATICFILES_DIRS = (str(BASE_DIR.joinpath("static")), str(BASE_DIR.joinpath("{{app_to_install}}/static"))) +STATICFILES_DIRS = ( + str(BASE_DIR.joinpath("static")), + str(BASE_DIR.joinpath("thw/static")), +) STATIC_ROOT = str(BASE_DIR.joinpath("staticfiles")) STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" MEDIA_ROOT = BASE_DIR.joinpath("media") diff --git a/core/urls.py b/core/urls.py index 5d19d70094339c626264b6db88d140c7fed8606a..870a932b4d2fd4d6c79cd9dabc886b60fb2b9935 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,18 +1,3 @@ -"""wedding URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/4.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 core import settings from django.contrib import admin from django.urls import path, include, re_path diff --git a/requirements.txt b/requirements.txt index 23c23af5f1fa9bbdffd256a84239fcc5a928c21e..62db08ae1681c76d6c5c189429a9868265f1eaa8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ Django==5.0 whitenoise==6.6.0 -gunicorn==21.2.0 \ No newline at end of file +gunicorn==21.2.0 diff --git a/templates/base.html b/templates/base.html index 996ad42dfc1f79827c8b7a50be1690a258d340cd..501f95378ed278c20e01ab081aff41e1adeb33cf 100644 --- a/templates/base.html +++ b/templates/base.html @@ -30,7 +30,7 @@ </a> {% endblock %} </div> - <div class="flex-none hidden lg:block z-10"> + <div class="flex-none hidden lg:block z-[60]"> <ul class="menu menu-horizontal"> {% block navbar_links %} <li><a>Item 1</a></li> @@ -76,7 +76,7 @@ {% endblock %} </main> </div> - <div class="drawer-side"> + <div class="drawer-side z-[60]"> <label for="drawer" class="drawer-overlay"></label> <ul class="menu p-4 w-80 min-h-full bg-base-200"> {% block sidebar_links %} @@ -89,4 +89,4 @@ </div> </div> </body> -</html> \ No newline at end of file +</html> diff --git a/templates/django/forms/div.html b/templates/django/forms/div.html new file mode 100644 index 0000000000000000000000000000000000000000..35bf7ec8b0e9ef77b8f7a16524932410bdd49527 --- /dev/null +++ b/templates/django/forms/div.html @@ -0,0 +1,32 @@ +{{ errors }} + +{% if errors and not fields %} + <div>{% for field in hidden_fields %}{{ field }}{% endfor %}</div> +{% endif %} + +{% for field, errors in fields %} + <div class="form-control w-full min-w-fit max-w-sm m-2"> + {% if field.label %} + <div class="label"> + <span class="label-text">{{ field.label_tag }}</span> + </div> + {% endif %} + {{ field }} + {% if field.help_text %} + <div class="label"> + {% if errors %} + <span class="label-text-alt text-error">{{ errors }}</span> + {% else %} + <span class="label-text-alt">{{ field.help_text|safe }}</span> + {% endif %} + </div> + {% endif %} + {% if forloop.last %} + {% for field in hidden_fields %}{{ field }}{% endfor %} + {% endif %} + </div> +{% endfor %} + +{% if not fields and not errors %} + {% for field in hidden_fields %}{{ field }}{% endfor %} +{% endif %} diff --git a/templates/django/forms/widgets/input.html b/templates/django/forms/widgets/input.html new file mode 100644 index 0000000000000000000000000000000000000000..8ac554aced6389a2ae816da9328fa3b426b23cab --- /dev/null +++ b/templates/django/forms/widgets/input.html @@ -0,0 +1,3 @@ +<input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value=" +{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} + class="input input-bordered w-full"> diff --git a/templates/django/forms/widgets/select.html b/templates/django/forms/widgets/select.html new file mode 100644 index 0000000000000000000000000000000000000000..5c9bb25eeb87c2c199cb7d3392096f61103729b0 --- /dev/null +++ b/templates/django/forms/widgets/select.html @@ -0,0 +1,14 @@ +<select name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} + class="select select-bordered w-full"> + {% for group_name, group_choices, group_index in widget.optgroups %} + {% if group_name %} + <optgroup label="{{ group_name }}"> + {% endif %} + {% for option in group_choices %} + {% include option.template_name with widget=option %} + {% endfor %} + {% if group_name %} + </optgroup> + {% endif %} + {% endfor %} +</select>