django-grep 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_grep-0.1.0/PKG-INFO +25 -0
- django_grep-0.1.0/README.md +12 -0
- django_grep-0.1.0/pyproject.toml +22 -0
- django_grep-0.1.0/setup.cfg +4 -0
- django_grep-0.1.0/src/django_grep/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/components/__init__.py +3 -0
- django_grep-0.1.0/src/django_grep/components/_init.py +233 -0
- django_grep-0.1.0/src/django_grep/components/adapters/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/components/adapters/base.py +90 -0
- django_grep-0.1.0/src/django_grep/components/adapters/main.py +48 -0
- django_grep-0.1.0/src/django_grep/components/adapters/test.py +57 -0
- django_grep-0.1.0/src/django_grep/components/apps.py +20 -0
- django_grep-0.1.0/src/django_grep/components/blocks/__init__.py +9 -0
- django_grep-0.1.0/src/django_grep/components/blocks/base.py +143 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/__init__.py +9 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/contactCard.py +91 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/contactMethods.py +114 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/form.py +309 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/hours.py +60 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/map.py +151 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/socialLinks.py +145 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/streamBlocks.py +35 -0
- django_grep-0.1.0/src/django_grep/components/blocks/contact/websiteLinks.py +896 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/__init__.py +7 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/cta.py +596 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/heading.py +69 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/objectives.py +31 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/overview.py +72 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/paragraph.py +70 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/quote.py +113 -0
- django_grep-0.1.0/src/django_grep/components/blocks/content/title.py +54 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/document.py +73 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/embed.py +63 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/gallery.py +208 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/html.py +55 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/image.py +380 -0
- django_grep-0.1.0/src/django_grep/components/blocks/media/video.py +307 -0
- django_grep-0.1.0/src/django_grep/components/blocks/mixins.py +117 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/about.py +319 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/event.py +513 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/project.py +102 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/services.py +82 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/streamBlocks.py +0 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/team.py +400 -0
- django_grep-0.1.0/src/django_grep/components/blocks/pages/testimonial.py +126 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/button.py +41 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/certification.py +85 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/faq.py +57 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/hero.py +46 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/section.py +159 -0
- django_grep-0.1.0/src/django_grep/components/blocks/partials/tables.py +258 -0
- django_grep-0.1.0/src/django_grep/components/blocks/profile/__init__.py +3 -0
- django_grep-0.1.0/src/django_grep/components/blocks/profile/details.py +21 -0
- django_grep-0.1.0/src/django_grep/components/blocks/profile/info.py +60 -0
- django_grep-0.1.0/src/django_grep/components/blocks/profile/streamBlocks.py +39 -0
- django_grep-0.1.0/src/django_grep/components/blocks/streamBlocks.py +12 -0
- django_grep-0.1.0/src/django_grep/components/conf.py +89 -0
- django_grep-0.1.0/src/django_grep/components/management/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/components/management/commands/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/components/management/commands/generate_asset_manifest.py +37 -0
- django_grep-0.1.0/src/django_grep/components/manifest.py +169 -0
- django_grep-0.1.0/src/django_grep/components/options.py +119 -0
- django_grep-0.1.0/src/django_grep/components/params.py +118 -0
- django_grep-0.1.0/src/django_grep/components/plugins/__init__.py +7 -0
- django_grep-0.1.0/src/django_grep/components/plugins/hookspecs.py +73 -0
- django_grep-0.1.0/src/django_grep/components/plugins/manager.py +22 -0
- django_grep-0.1.0/src/django_grep/components/site/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/components/site/context.py +442 -0
- django_grep-0.1.0/src/django_grep/components/site/notifications.py +605 -0
- django_grep-0.1.0/src/django_grep/components/site/pageHandler.py +387 -0
- django_grep-0.1.0/src/django_grep/components/site/paginators.py +393 -0
- django_grep-0.1.0/src/django_grep/components/site/plugins.py +274 -0
- django_grep-0.1.0/src/django_grep/components/site/response.py +126 -0
- django_grep-0.1.0/src/django_grep/components/staticfiles.py +277 -0
- django_grep-0.1.0/src/django_grep/components/templates.py +214 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/apps.py +269 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/breadcrumbs.py +33 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/calender.py +20 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/card.py +29 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/field.py +32 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/gallary.py +60 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/menu.py +21 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/modal.py +32 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/notification.py +23 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/price.py +12 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components/table.py +55 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/components.py +16 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/contentType.py +15 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/embedBlocks.py +38 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/tags/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/tags/asset.py +72 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/tags/block.py +82 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/tags/prop.py +41 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/tags/slot.py +58 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/tags/var.py +84 -0
- django_grep-0.1.0/src/django_grep/components/templatetags/userRole.py +207 -0
- django_grep-0.1.0/src/django_grep/components/up.py +290 -0
- django_grep-0.1.0/src/django_grep/conf.py +85 -0
- django_grep-0.1.0/src/django_grep/conf_utils.py +85 -0
- django_grep-0.1.0/src/django_grep/contrib/__init__.py +827 -0
- django_grep-0.1.0/src/django_grep/contrib/admin_site.py +45 -0
- django_grep-0.1.0/src/django_grep/contrib/cache.py +335 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/cart.py +9 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/contact.py +15 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/message.py +16 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/module.py +9 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/styles.py +36 -0
- django_grep-0.1.0/src/django_grep/contrib/choices/token.py +16 -0
- django_grep-0.1.0/src/django_grep/contrib/context/__init__.py +5 -0
- django_grep-0.1.0/src/django_grep/contrib/context/auth.py +11 -0
- django_grep-0.1.0/src/django_grep/contrib/context/cookies.py +11 -0
- django_grep-0.1.0/src/django_grep/contrib/context/htmx.py +6 -0
- django_grep-0.1.0/src/django_grep/contrib/context/languages.py +58 -0
- django_grep-0.1.0/src/django_grep/contrib/context/settings.py +33 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/__init__.py +299 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/autoreload.py +195 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/base.py +527 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/config.py +122 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/core.py +208 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/detection.py +63 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/development.py +106 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/middleware.py +207 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/monitoring.py +80 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/orchestrator.py +106 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/prometheus.py +98 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/sentry.py +90 -0
- django_grep-0.1.0/src/django_grep/contrib/debug_tools/urls.py +73 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/__init__.py +7 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/database.py +9 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/email.py +10 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/logs.py +9 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/main.py +51 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/repo.py +34 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/env/storage.py +10 -0
- django_grep-0.1.0/src/django_grep/contrib/enums/upload.py +12 -0
- django_grep-0.1.0/src/django_grep/contrib/migrations/0001_initial.py +42 -0
- django_grep-0.1.0/src/django_grep/contrib/migrations/0002_alter_domain_unique.py +20 -0
- django_grep-0.1.0/src/django_grep/contrib/migrations/0003_set_site_domain_and_name.py +53 -0
- django_grep-0.1.0/src/django_grep/contrib/migrations/0004_alter_options_ordering_domain.py +59 -0
- django_grep-0.1.0/src/django_grep/contrib/migrations/__init__.py +5 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/__init__.py +1 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/encoder.py +49 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/exceptions/__init__.py +3 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/exceptions/api.py +18 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/exceptions/invitation.py +13 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/exceptions/schema.py +28 -0
- django_grep-0.1.0/src/django_grep/contrib/responses/responses.py +69 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/file.py +37 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/logging.py +0 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/message.py +0 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/model_schema.py +58 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/notification.py +0 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/response.py +10 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/serializer.py +28 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/users/__init__.py +5 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/users/token.py +390 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/users/user.py +608 -0
- django_grep-0.1.0/src/django_grep/contrib/schemas/users/utils.py +159 -0
- django_grep-0.1.0/src/django_grep/contrib/utils.py +50 -0
- django_grep-0.1.0/src/django_grep/pipelines/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/pipelines/apps.py +12 -0
- django_grep-0.1.0/src/django_grep/pipelines/backends/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/pipelines/backends/auth.py +89 -0
- django_grep-0.1.0/src/django_grep/pipelines/conf.py +1187 -0
- django_grep-0.1.0/src/django_grep/pipelines/filters/__init__.py +17 -0
- django_grep-0.1.0/src/django_grep/pipelines/filters/base.py +171 -0
- django_grep-0.1.0/src/django_grep/pipelines/filters/cache.py +123 -0
- django_grep-0.1.0/src/django_grep/pipelines/filters/token.py +103 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/__init__.py +5 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/admin.py +290 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/__init__.py +70 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/code.py +136 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/confirm.py +128 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/login.py +257 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/password.py +400 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/phone.py +224 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/signup.py +196 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/authentication/social.py +0 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/base.py +422 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/group.py +196 -0
- django_grep-0.1.0/src/django_grep/pipelines/forms/mixins.py +156 -0
- django_grep-0.1.0/src/django_grep/pipelines/managers/__init__.py +19 -0
- django_grep-0.1.0/src/django_grep/pipelines/managers/base.py +433 -0
- django_grep-0.1.0/src/django_grep/pipelines/managers/search.py +265 -0
- django_grep-0.1.0/src/django_grep/pipelines/managers/tags.py +592 -0
- django_grep-0.1.0/src/django_grep/pipelines/managers/token.py +319 -0
- django_grep-0.1.0/src/django_grep/pipelines/managers/user.py +406 -0
- django_grep-0.1.0/src/django_grep/pipelines/middlewares/freeze.py +27 -0
- django_grep-0.1.0/src/django_grep/pipelines/middlewares/language.py +21 -0
- django_grep-0.1.0/src/django_grep/pipelines/middlewares/service.py +16 -0
- django_grep-0.1.0/src/django_grep/pipelines/middlewares/site.py +228 -0
- django_grep-0.1.0/src/django_grep/pipelines/migrations/0001_initial.py +791 -0
- django_grep-0.1.0/src/django_grep/pipelines/migrations/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/pipelines/mixins/__init__.py +18 -0
- django_grep-0.1.0/src/django_grep/pipelines/mixins/cache.py +231 -0
- django_grep-0.1.0/src/django_grep/pipelines/mixins/search.py +211 -0
- django_grep-0.1.0/src/django_grep/pipelines/mixins/service.py +87 -0
- django_grep-0.1.0/src/django_grep/pipelines/mixins/token.py +196 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/cache.py +81 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/contacts/__init__.py +3 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/contacts/base.py +331 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/contacts/contact.py +120 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/contacts/person.py +88 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/default.py +553 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/enums/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/enums/activities.py +103 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/enums/statuses.py +201 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/locations/__init__.py +3 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/locations/address.py +19 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/locations/branch.py +43 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/locations/city.py +58 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/__init__.py +7 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/email.py +208 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/newsletter.py +284 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/settings.py +552 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/subscription.py +153 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/tasks.py +129 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/settings/templates.py +1691 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/tags.py +1222 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/users/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/users/role.py +124 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/users/team.py +776 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/users/token.py +202 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/users/users.py +1438 -0
- django_grep-0.1.0/src/django_grep/pipelines/models/workspace.py +165 -0
- django_grep-0.1.0/src/django_grep/pipelines/routes/__init__.py +41 -0
- django_grep-0.1.0/src/django_grep/pipelines/routes/base.py +645 -0
- django_grep-0.1.0/src/django_grep/pipelines/routes/model.py +86 -0
- django_grep-0.1.0/src/django_grep/pipelines/routes/other.py +251 -0
- django_grep-0.1.0/src/django_grep/pipelines/routes/sites.py +207 -0
- django_grep-0.1.0/src/django_grep/pipelines/services/__init__.py +19 -0
- django_grep-0.1.0/src/django_grep/pipelines/services/base.py +188 -0
- django_grep-0.1.0/src/django_grep/pipelines/services/crud.py +408 -0
- django_grep-0.1.0/src/django_grep/pipelines/services/search.py +242 -0
- django_grep-0.1.0/src/django_grep/pipelines/services/token.py +229 -0
- django_grep-0.1.0/src/django_grep/pipelines/signals/__init__.py +1 -0
- django_grep-0.1.0/src/django_grep/pipelines/signals/binding.py +10 -0
- django_grep-0.1.0/src/django_grep/pipelines/signals/invitations.py +14 -0
- django_grep-0.1.0/src/django_grep/pipelines/signals/notification.py +41 -0
- django_grep-0.1.0/src/django_grep/pipelines/signals/utils.py +54 -0
- django_grep-0.1.0/src/django_grep/pipelines/signals/wagtail.py +37 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/__init__.py +11 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/__init__.py +6 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/forget_password.py +132 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/login.py +73 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/mixins.py +452 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/register.py +451 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/reset_password.py +208 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/auth/verification_link.py +233 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/__init__.py +20 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/actions.py +102 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/base.py +122 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/create.py +203 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/delete.py +92 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/detail.py +95 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/list.py +178 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/list2.py +789 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/table.py +14 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/generic/update.py +245 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/notifications.py +70 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/search.py +66 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/tags.py +274 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/translate.py +0 -0
- django_grep-0.1.0/src/django_grep/pipelines/site/users/__init__.py +0 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/__init__.py +2 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/base.py +149 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/__init__.py +5 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/contacts.py +44 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/departments.py +97 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/events.py +53 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/partners.py +38 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/peoples.py +476 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/services.py +44 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/manage/team.py +270 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/site/__init__.py +4 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/site/email.py +17 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/site/media.py +22 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/site/platform.py +174 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/site/social.py +14 -0
- django_grep-0.1.0/src/django_grep/pipelines/snippets/tags.py +622 -0
- django_grep-0.1.0/src/django_grep/pipelines/urls.py +35 -0
- django_grep-0.1.0/src/django_grep/pipelines/utils/__init__.py +35 -0
- django_grep-0.1.0/src/django_grep/pipelines/utils/cache.py +75 -0
- django_grep-0.1.0/src/django_grep/pipelines/utils/token.py +82 -0
- django_grep-0.1.0/src/django_grep/pipelines/utils/validation.py +49 -0
- django_grep-0.1.0/src/django_grep/pipelines/wagtail_hooks.py +137 -0
- django_grep-0.1.0/src/django_grep/routes/__init__.py +41 -0
- django_grep-0.1.0/src/django_grep/routes/base.py +645 -0
- django_grep-0.1.0/src/django_grep/routes/model.py +86 -0
- django_grep-0.1.0/src/django_grep/routes/other.py +251 -0
- django_grep-0.1.0/src/django_grep/routes/sites.py +207 -0
- django_grep-0.1.0/src/django_grep/typing.py +12 -0
- django_grep-0.1.0/src/django_grep.egg-info/PKG-INFO +25 -0
- django_grep-0.1.0/src/django_grep.egg-info/SOURCES.txt +303 -0
- django_grep-0.1.0/src/django_grep.egg-info/dependency_links.txt +1 -0
- django_grep-0.1.0/src/django_grep.egg-info/requires.txt +2 -0
- django_grep-0.1.0/src/django_grep.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-grep
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Core CTC website components, pipelines, and utilities for Wagtail/Django
|
|
5
|
+
Project-URL: Homepage, https://example.com
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Framework :: Django
|
|
8
|
+
Classifier: Framework :: Wagtail
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: Django
|
|
12
|
+
Requires-Dist: wagtail
|
|
13
|
+
|
|
14
|
+
# Django GREP
|
|
15
|
+
|
|
16
|
+
The complete core library for the CTC website (formerly wagtail-ctc), including:
|
|
17
|
+
- **Components**: Block framework for Wagtail.
|
|
18
|
+
- **Pipelines**: Enhanced model workflows and utilities.
|
|
19
|
+
- **Utils**: Shared core utilities.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install django-grep
|
|
25
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Django GREP
|
|
2
|
+
|
|
3
|
+
The complete core library for the CTC website (formerly wagtail-ctc), including:
|
|
4
|
+
- **Components**: Block framework for Wagtail.
|
|
5
|
+
- **Pipelines**: Enhanced model workflows and utilities.
|
|
6
|
+
- **Utils**: Shared core utilities.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install django-grep
|
|
12
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "django-grep"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Core CTC website components, pipelines, and utilities for Wagtail/Django"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Framework :: Django",
|
|
14
|
+
"Framework :: Wagtail",
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"Django",
|
|
18
|
+
"wagtail",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
"Homepage" = "https://example.com"
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import itertools
|
|
4
|
+
from collections import defaultdict
|
|
5
|
+
from collections.abc import Generator, Iterable
|
|
6
|
+
from dataclasses import dataclass, field
|
|
7
|
+
from hashlib import md5
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from threading import Lock
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from django.conf import settings
|
|
13
|
+
from django.template.backends.django import Template as DjangoTemplate
|
|
14
|
+
from django.template.base import Node, NodeList, TextNode
|
|
15
|
+
from django.template.context import Context
|
|
16
|
+
from django.template.loader import select_template
|
|
17
|
+
|
|
18
|
+
from django_grep.components.conf import _settings
|
|
19
|
+
|
|
20
|
+
from .params import Param, Params, Value
|
|
21
|
+
from .plugins import pm
|
|
22
|
+
from .staticfiles import Asset, AssetType
|
|
23
|
+
from .templates import (
|
|
24
|
+
find_components_in_template,
|
|
25
|
+
get_component_directories,
|
|
26
|
+
get_template_names,
|
|
27
|
+
)
|
|
28
|
+
from .templatetags.tags.block import BlockNode
|
|
29
|
+
from .templatetags.tags.slot import DEFAULT_SLOT, SlotNode
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True, slots=True)
|
|
33
|
+
class Component:
|
|
34
|
+
name: str
|
|
35
|
+
template: DjangoTemplate
|
|
36
|
+
assets: frozenset[Asset] = field(default_factory=frozenset)
|
|
37
|
+
|
|
38
|
+
def get_asset(self, asset_filename: str) -> Asset | None:
|
|
39
|
+
for asset in self.assets:
|
|
40
|
+
if asset.path.name == asset_filename:
|
|
41
|
+
return asset
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
def get_bound_component(self, node: BlockNode):
|
|
45
|
+
params = Params.from_node(node)
|
|
46
|
+
return BoundComponent(component=self, params=params, nodelist=node.nodelist)
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def data_attribute_name(self):
|
|
50
|
+
return self.name.replace(".", "-")
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def id(self):
|
|
54
|
+
normalized_source = "".join(self.source.split())
|
|
55
|
+
hashed = md5(f"{self.name}:{self.path}:{normalized_source}".encode()).hexdigest()
|
|
56
|
+
return hashed[:7]
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def nodelist(self):
|
|
60
|
+
return self.template.template.nodelist
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def path(self):
|
|
64
|
+
return self.template.template.origin.name
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def source(self):
|
|
68
|
+
return self.template.template.source
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_abs_path(cls, path: Path) -> Component:
|
|
72
|
+
template = select_template([str(path)])
|
|
73
|
+
return cls.from_template(template)
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_name(cls, name: str) -> Component:
|
|
77
|
+
template_names = get_template_names(name)
|
|
78
|
+
template = select_template(template_names)
|
|
79
|
+
return cls.from_template(template)
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_template(cls, template: DjangoTemplate) -> Component:
|
|
83
|
+
template_path = Path(template.template.origin.name)
|
|
84
|
+
|
|
85
|
+
for component_dir in get_component_directories():
|
|
86
|
+
try:
|
|
87
|
+
relative_path = template_path.relative_to(component_dir)
|
|
88
|
+
name = str(relative_path.with_suffix("")).replace("/", ".")
|
|
89
|
+
break
|
|
90
|
+
except ValueError:
|
|
91
|
+
continue
|
|
92
|
+
else:
|
|
93
|
+
name = template_path.stem
|
|
94
|
+
|
|
95
|
+
assets: list[Iterable[Asset]] = pm.hook.collect_component_assets(
|
|
96
|
+
template_path=Path(template.template.origin.name)
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return cls(name=name, template=template, assets=frozenset(itertools.chain(*assets)))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class SequenceGenerator:
|
|
103
|
+
_instance: SequenceGenerator | None = None
|
|
104
|
+
_lock: Lock = Lock()
|
|
105
|
+
_counters: dict[str, int]
|
|
106
|
+
|
|
107
|
+
def __init__(self) -> None:
|
|
108
|
+
if not hasattr(self, "_counters"):
|
|
109
|
+
self._counters = {}
|
|
110
|
+
|
|
111
|
+
def __new__(cls) -> SequenceGenerator:
|
|
112
|
+
if cls._instance is None:
|
|
113
|
+
with cls._lock:
|
|
114
|
+
if cls._instance is None:
|
|
115
|
+
cls._instance = super().__new__(cls)
|
|
116
|
+
return cls._instance
|
|
117
|
+
|
|
118
|
+
def next(self, component: Component) -> int:
|
|
119
|
+
with self._lock:
|
|
120
|
+
current = self._counters.get(component.id, 0) + 1
|
|
121
|
+
self._counters[component.id] = current
|
|
122
|
+
return current
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@dataclass
|
|
126
|
+
class BoundComponent:
|
|
127
|
+
component: Component
|
|
128
|
+
params: Params
|
|
129
|
+
nodelist: NodeList | None
|
|
130
|
+
_sequence: SequenceGenerator = field(default_factory=SequenceGenerator)
|
|
131
|
+
|
|
132
|
+
def render(self, context: Context):
|
|
133
|
+
if _settings.ENABLE_BLOCK_ATTRS:
|
|
134
|
+
data_attrs = [
|
|
135
|
+
Param(
|
|
136
|
+
f"data-block-{self.component.data_attribute_name}",
|
|
137
|
+
Value(True),
|
|
138
|
+
),
|
|
139
|
+
Param("data-block-id", Value(f'"{self.component.id}-{self.id}"')),
|
|
140
|
+
]
|
|
141
|
+
self.params.attrs.extend(data_attrs)
|
|
142
|
+
|
|
143
|
+
props = self.params.render_props(self.component, context)
|
|
144
|
+
attrs = self.params.render_attrs(context)
|
|
145
|
+
slots = self.fill_slots(context)
|
|
146
|
+
|
|
147
|
+
with context.push(
|
|
148
|
+
**{
|
|
149
|
+
"attrs": attrs,
|
|
150
|
+
"props": props,
|
|
151
|
+
"slot": slots.get(DEFAULT_SLOT),
|
|
152
|
+
"slots": slots,
|
|
153
|
+
"vars": {},
|
|
154
|
+
}
|
|
155
|
+
):
|
|
156
|
+
return self.component.template.template.render(context)
|
|
157
|
+
|
|
158
|
+
def fill_slots(self, context: Context):
|
|
159
|
+
if self.nodelist is None:
|
|
160
|
+
return {
|
|
161
|
+
DEFAULT_SLOT: None,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
slot_nodes = {node.name: node for node in self.nodelist if isinstance(node, SlotNode)}
|
|
165
|
+
default_nodes = NodeList([node for node in self.nodelist if not isinstance(node, SlotNode)])
|
|
166
|
+
|
|
167
|
+
slots: dict[str, Node | NodeList] = {
|
|
168
|
+
DEFAULT_SLOT: default_nodes,
|
|
169
|
+
**slot_nodes,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if not slots[DEFAULT_SLOT] and "slot" in context:
|
|
173
|
+
slots[DEFAULT_SLOT] = TextNode(context["slot"])
|
|
174
|
+
|
|
175
|
+
return {name: node.render(context) for name, node in slots.items() if node}
|
|
176
|
+
|
|
177
|
+
@property
|
|
178
|
+
def id(self):
|
|
179
|
+
return str(self._sequence.next(self.component))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class ComponentRegistry:
|
|
183
|
+
def __init__(self):
|
|
184
|
+
self._component_usage: dict[str, set[Path]] = defaultdict(set)
|
|
185
|
+
self._components: dict[str, Component] = {}
|
|
186
|
+
self._template_usage: dict[Path, set[str]] = defaultdict(set)
|
|
187
|
+
|
|
188
|
+
def reset(self) -> None:
|
|
189
|
+
"""Reset the registry, used for testing."""
|
|
190
|
+
self._component_usage = defaultdict(set)
|
|
191
|
+
self._components = {}
|
|
192
|
+
self._template_usage = defaultdict(set)
|
|
193
|
+
|
|
194
|
+
def get_assets(self, asset_type: AssetType | None = None) -> frozenset[Asset]:
|
|
195
|
+
return frozenset(
|
|
196
|
+
asset
|
|
197
|
+
for component in self._components.values()
|
|
198
|
+
for asset in component.assets
|
|
199
|
+
if asset_type is None or asset.type == asset_type
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def get_component(self, name: str) -> Component:
|
|
203
|
+
if name in self._components and not settings.DEBUG:
|
|
204
|
+
return self._components[name]
|
|
205
|
+
|
|
206
|
+
self._components[name] = Component.from_name(name)
|
|
207
|
+
if name not in self._component_usage:
|
|
208
|
+
self._component_usage[name] = set()
|
|
209
|
+
return self._components[name]
|
|
210
|
+
|
|
211
|
+
def get_component_names_used_in_template(self, template_path: str | Path) -> set[str]:
|
|
212
|
+
"""Get names of components used in a template."""
|
|
213
|
+
|
|
214
|
+
path = Path(template_path)
|
|
215
|
+
|
|
216
|
+
if path in self._template_usage:
|
|
217
|
+
return self._template_usage[path]
|
|
218
|
+
|
|
219
|
+
components = find_components_in_template(template_path)
|
|
220
|
+
|
|
221
|
+
self._template_usage[path] = components
|
|
222
|
+
for component_name in components:
|
|
223
|
+
self._component_usage[component_name].add(path)
|
|
224
|
+
|
|
225
|
+
return components
|
|
226
|
+
|
|
227
|
+
def get_component_usage(self, template_path: str | Path) -> Generator[Component, Any, None]:
|
|
228
|
+
"""Get components used in a template."""
|
|
229
|
+
for component_name in self.get_component_names_used_in_template(template_path):
|
|
230
|
+
yield Component.from_name(component_name)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
components = ComponentRegistry()
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
UP_METHOD_COOKIE = "_up_method"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BaseAdapter:
|
|
11
|
+
"""
|
|
12
|
+
Provides the entrypoint for other frameworks to use this library.
|
|
13
|
+
|
|
14
|
+
Implements common functionality that is not often overriden as well
|
|
15
|
+
as framework specific hooks.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def request_headers(self) -> Mapping[str, str]:
|
|
19
|
+
"""Reads the request headers from the current request.
|
|
20
|
+
|
|
21
|
+
Needs to be implemented."""
|
|
22
|
+
raise NotImplementedError # pragma: no cover
|
|
23
|
+
|
|
24
|
+
def request_params(self) -> Mapping[str, str]:
|
|
25
|
+
"""Reads the GET params from the current request.
|
|
26
|
+
|
|
27
|
+
Needs to be implemented."""
|
|
28
|
+
raise NotImplementedError # pragma: no cover
|
|
29
|
+
|
|
30
|
+
def redirect_uri(self, response: Any) -> str | None:
|
|
31
|
+
"""Returns the redirect target of a response or None if the response
|
|
32
|
+
is not a redirection (ie if it's status code is not in the range 300-400).
|
|
33
|
+
|
|
34
|
+
Needs to be implemented."""
|
|
35
|
+
raise NotImplementedError # pragma: no cover
|
|
36
|
+
|
|
37
|
+
def set_redirect_uri(self, response: Any, uri: str) -> None:
|
|
38
|
+
"""Set a new redirect target for the current response. This is used to
|
|
39
|
+
pass unpoly parameters via GET params through redirects.
|
|
40
|
+
|
|
41
|
+
Needs to be implemented."""
|
|
42
|
+
raise NotImplementedError # pragma: no cover
|
|
43
|
+
|
|
44
|
+
def set_headers(self, response: Any, headers: Mapping[str, str]) -> None:
|
|
45
|
+
"""Set headers like `X-Up-Location` on the current response.
|
|
46
|
+
|
|
47
|
+
Needs to be implemented."""
|
|
48
|
+
raise NotImplementedError # pragma: no cover
|
|
49
|
+
|
|
50
|
+
def set_cookie(self, response: Any, needs_cookie: bool = False) -> None:
|
|
51
|
+
"""Set or delete the `_up_method <https://unpoly.com/_up_method>`_ cookie.
|
|
52
|
+
|
|
53
|
+
The implementation should set the cookie if `needs_cookie` is `True` and
|
|
54
|
+
otherwise remove it if set.
|
|
55
|
+
|
|
56
|
+
Needs to be implemented."""
|
|
57
|
+
raise NotImplementedError # pragma: no cover
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def method(self) -> str:
|
|
61
|
+
"""Exposes the current request's method (GET/POST etc)
|
|
62
|
+
|
|
63
|
+
Needs to be implemented."""
|
|
64
|
+
raise NotImplementedError # pragma: no cover
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def location(self) -> str:
|
|
68
|
+
"""Exposes the current request's location (path including query params)
|
|
69
|
+
|
|
70
|
+
Needs to be implemented."""
|
|
71
|
+
raise NotImplementedError # pragma: no cover
|
|
72
|
+
|
|
73
|
+
def deserialize_data(self, data: str) -> object:
|
|
74
|
+
"""Deserializes data passed in by Unpoly.
|
|
75
|
+
|
|
76
|
+
By default it simply reads it as JSON, but can be overriden if custom
|
|
77
|
+
decoders are needed.
|
|
78
|
+
"""
|
|
79
|
+
try:
|
|
80
|
+
return json.loads(data)
|
|
81
|
+
except json.JSONDecodeError:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
def serialize_data(self, data: object) -> str:
|
|
85
|
+
"""Serializes the data for passing it to Unpoly.
|
|
86
|
+
|
|
87
|
+
By default it simply serializes it as JSON, but can be overriden if custom
|
|
88
|
+
encoders are needed.
|
|
89
|
+
"""
|
|
90
|
+
return json.dumps(data, separators=(",", ":"), ensure_ascii=True)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import cast
|
|
5
|
+
|
|
6
|
+
from django.http import HttpRequest, HttpResponse
|
|
7
|
+
|
|
8
|
+
from .base import BaseAdapter
|
|
9
|
+
|
|
10
|
+
UP_METHOD_COOKIE = "_up_method"
|
|
11
|
+
|
|
12
|
+
class DjangoAdapter(BaseAdapter):
|
|
13
|
+
def __init__(self, request: HttpRequest):
|
|
14
|
+
self.request = request
|
|
15
|
+
|
|
16
|
+
def request_headers(self) -> Mapping[str, str]:
|
|
17
|
+
return cast(Mapping[str, str], self.request.headers)
|
|
18
|
+
|
|
19
|
+
def request_params(self) -> Mapping[str, str]:
|
|
20
|
+
return self.request.GET
|
|
21
|
+
|
|
22
|
+
def redirect_uri(self, response: HttpResponse) -> str | None:
|
|
23
|
+
return (
|
|
24
|
+
cast(Mapping[str, str], response.headers).get("Location")
|
|
25
|
+
if 300 <= response.status_code < 400
|
|
26
|
+
else None
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
def set_redirect_uri(self, response: HttpResponse, uri: str) -> None:
|
|
30
|
+
response.headers["Location"] = uri
|
|
31
|
+
|
|
32
|
+
def set_headers(self, response: HttpResponse, headers: Mapping[str, str]) -> None:
|
|
33
|
+
for k, v in headers.items():
|
|
34
|
+
response.headers[k] = v
|
|
35
|
+
|
|
36
|
+
def set_cookie(self, response: HttpResponse, needs_cookie: bool = False) -> None:
|
|
37
|
+
if needs_cookie:
|
|
38
|
+
response.set_cookie(UP_METHOD_COOKIE, self.method)
|
|
39
|
+
elif UP_METHOD_COOKIE in self.request.COOKIES:
|
|
40
|
+
response.delete_cookie(UP_METHOD_COOKIE)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def method(self) -> str:
|
|
44
|
+
return cast(str, self.request.method)
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def location(self) -> str:
|
|
48
|
+
return self.request.get_full_path_info()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from contrib.setup.ext.adapter import BaseAdapter
|
|
6
|
+
|
|
7
|
+
UP_METHOD_COOKIE = "_up_method"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
11
|
+
from collections.abc import Mapping
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SimpleAdapter(BaseAdapter):
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
method: str = "GET",
|
|
19
|
+
location: str = "/",
|
|
20
|
+
headers: dict[str, str] | None = None,
|
|
21
|
+
params: dict[str, str] | None = None,
|
|
22
|
+
redirect_uri: str | None = None,
|
|
23
|
+
):
|
|
24
|
+
self._method = method
|
|
25
|
+
self._location = location
|
|
26
|
+
self.headers = headers or {}
|
|
27
|
+
self.params = params or {}
|
|
28
|
+
self._redirect_uri = redirect_uri
|
|
29
|
+
self.response_redirect_uri: str | None = None
|
|
30
|
+
self.response_headers: Mapping[str, str] | None = None
|
|
31
|
+
self.cookie: bool | None = None
|
|
32
|
+
|
|
33
|
+
def request_headers(self) -> Mapping[str, str]:
|
|
34
|
+
return self.headers
|
|
35
|
+
|
|
36
|
+
def request_params(self) -> Mapping[str, str]:
|
|
37
|
+
return self.params
|
|
38
|
+
|
|
39
|
+
def redirect_uri(self, response: object) -> str | None:
|
|
40
|
+
return self._redirect_uri
|
|
41
|
+
|
|
42
|
+
def set_redirect_uri(self, response: object, uri: str) -> None:
|
|
43
|
+
self.response_redirect_uri = uri
|
|
44
|
+
|
|
45
|
+
def set_headers(self, response: object, headers: Mapping[str, str]) -> None:
|
|
46
|
+
self.response_headers = headers
|
|
47
|
+
|
|
48
|
+
def set_cookie(self, response: object, needs_cookie: bool = False) -> None:
|
|
49
|
+
self.cookie = needs_cookie
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def method(self) -> str:
|
|
53
|
+
return self._method
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def location(self) -> str:
|
|
57
|
+
return self._location
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from django.apps import AppConfig
|
|
2
|
+
from django.utils.translation import gettext_lazy as _
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CoreExtAppConfig(AppConfig):
|
|
6
|
+
label = "components"
|
|
7
|
+
name = "django_grep.components"
|
|
8
|
+
verbose_name = _("Core Extensions")
|
|
9
|
+
|
|
10
|
+
def ready(self):
|
|
11
|
+
from .plugins import pm
|
|
12
|
+
from .staticfiles import asset_types
|
|
13
|
+
|
|
14
|
+
for pre_ready in pm.hook.pre_ready():
|
|
15
|
+
pre_ready()
|
|
16
|
+
|
|
17
|
+
pm.hook.register_asset_types(register_type=asset_types.register_type)
|
|
18
|
+
|
|
19
|
+
for ready in pm.hook.ready():
|
|
20
|
+
ready()
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import uuid
|
|
3
|
+
|
|
4
|
+
from django.utils.translation import gettext_lazy as _
|
|
5
|
+
from wagtail import blocks
|
|
6
|
+
|
|
7
|
+
from .mixins import ResponsiveBlockMixin, StyledBlockMixin
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BaseBlock(StyledBlockMixin, ResponsiveBlockMixin, blocks.StructBlock):
|
|
13
|
+
"""
|
|
14
|
+
Enhanced base block class with built-in styling and responsive support.
|
|
15
|
+
Provides common functionality for all blocks.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
# Common fields for all blocks
|
|
19
|
+
custom_css_id = blocks.CharBlock(
|
|
20
|
+
required=False,
|
|
21
|
+
max_length=50,
|
|
22
|
+
label=_("Custom CSS ID"),
|
|
23
|
+
help_text=_("Custom HTML ID for CSS targeting and JavaScript."),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
custom_css_class = blocks.CharBlock(
|
|
27
|
+
required=False,
|
|
28
|
+
max_length=100,
|
|
29
|
+
label=_("Custom CSS Class"),
|
|
30
|
+
help_text=_("Additional CSS classes for custom styling."),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
data_attributes = blocks.RawHTMLBlock(
|
|
34
|
+
required=False,
|
|
35
|
+
label=_("Data Attributes"),
|
|
36
|
+
help_text=_("Custom data attributes for JavaScript interaction."),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Visibility controls
|
|
40
|
+
is_visible = blocks.BooleanBlock(
|
|
41
|
+
required=False,
|
|
42
|
+
default=True,
|
|
43
|
+
label=_("Visible"),
|
|
44
|
+
help_text=_("Toggle visibility of this block."),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# visibility_conditions = blocks.ChoiceBlock(
|
|
48
|
+
# required=False,
|
|
49
|
+
# choices=[
|
|
50
|
+
# ('always', _('Always Visible')),
|
|
51
|
+
# ('desktop', _('Desktop Only')),
|
|
52
|
+
# ('mobile', _('Mobile Only')),
|
|
53
|
+
# ('logged_in', _('Logged-in Users Only')),
|
|
54
|
+
# ('logged_out', _('Logged-out Users Only')),
|
|
55
|
+
# ],
|
|
56
|
+
# default='always',
|
|
57
|
+
# label=_("Visibility Conditions"),
|
|
58
|
+
# )
|
|
59
|
+
|
|
60
|
+
# # Responsive configuration
|
|
61
|
+
# responsive_config = blocks.StructBlock(
|
|
62
|
+
# [
|
|
63
|
+
# (
|
|
64
|
+
# "width",
|
|
65
|
+
# blocks.ChoiceBlock(
|
|
66
|
+
# required=False,
|
|
67
|
+
# choices=[
|
|
68
|
+
# ("full", _("Full Width")),
|
|
69
|
+
# ("container", _("Container Width")),
|
|
70
|
+
# ("narrow", _("Narrow Width")),
|
|
71
|
+
# ],
|
|
72
|
+
# default="container",
|
|
73
|
+
# label=_("Container Width"),
|
|
74
|
+
# ),
|
|
75
|
+
# ),
|
|
76
|
+
# (
|
|
77
|
+
# "padding",
|
|
78
|
+
# blocks.ChoiceBlock(
|
|
79
|
+
# required=False,
|
|
80
|
+
# choices=[
|
|
81
|
+
# ("none", _("No Padding")),
|
|
82
|
+
# ("small", _("Small Padding")),
|
|
83
|
+
# ("default", _("Default Padding")),
|
|
84
|
+
# ("large", _("Large Padding")),
|
|
85
|
+
# ],
|
|
86
|
+
# default="default",
|
|
87
|
+
# label=_("Padding Size"),
|
|
88
|
+
# ),
|
|
89
|
+
# ),
|
|
90
|
+
# (
|
|
91
|
+
# "background",
|
|
92
|
+
# blocks.ChoiceBlock(
|
|
93
|
+
# required=False,
|
|
94
|
+
# choices=[
|
|
95
|
+
# ("none", _("No Background")),
|
|
96
|
+
# ("light", _("Light Background")),
|
|
97
|
+
# ("dark", _("Dark Background")),
|
|
98
|
+
# ("gradient", _("Gradient Background")),
|
|
99
|
+
# ("pattern", _("Pattern Background")),
|
|
100
|
+
# ],
|
|
101
|
+
# default="none",
|
|
102
|
+
# label=_("Background Style"),
|
|
103
|
+
# ),
|
|
104
|
+
# ),
|
|
105
|
+
# ],
|
|
106
|
+
# required=False,
|
|
107
|
+
# label=_("Responsive Configuration"),
|
|
108
|
+
# )
|
|
109
|
+
|
|
110
|
+
def get_block_classes(self, value):
|
|
111
|
+
"""Get CSS classes for the block container."""
|
|
112
|
+
base_classes = self.get_styling_config().get("container", "")
|
|
113
|
+
responsive_classes = self.get_responsive_classes(value)
|
|
114
|
+
custom_classes = value.get("custom_css_class", "")
|
|
115
|
+
|
|
116
|
+
# Add visibility classes
|
|
117
|
+
visibility_class = ""
|
|
118
|
+
if value.get("visibility_conditions") != "always":
|
|
119
|
+
visibility_class = f"visible-{value['visibility_conditions']}"
|
|
120
|
+
|
|
121
|
+
classes = [base_classes, responsive_classes, custom_classes, visibility_class]
|
|
122
|
+
return " ".join(filter(None, classes))
|
|
123
|
+
|
|
124
|
+
def get_context(self, value, parent_context=None):
|
|
125
|
+
context = super().get_context(value, parent_context)
|
|
126
|
+
|
|
127
|
+
# Add framework info
|
|
128
|
+
context["framework"] = self.style_framework
|
|
129
|
+
context["css_prefix"] = self.css_prefix
|
|
130
|
+
|
|
131
|
+
# Generate unique block ID
|
|
132
|
+
block_id = value.get("custom_css_id") or f"block-{uuid.uuid4().hex[:8]}"
|
|
133
|
+
context["block_id"] = block_id
|
|
134
|
+
context["block_classes"] = self.get_block_classes(value)
|
|
135
|
+
|
|
136
|
+
return context
|
|
137
|
+
|
|
138
|
+
def render(self, value, context=None):
|
|
139
|
+
# Skip rendering if block is not visible
|
|
140
|
+
if not value.get("is_visible", True):
|
|
141
|
+
return ""
|
|
142
|
+
|
|
143
|
+
return super().render(value, context)
|