<form hx-post="/example" hx-ext="disable-submit">
<button type="submit" class="hx-disable button-default">Save</button>
</form>
htmx.defineExtension('disable-submit', {
onEvent: function (name, evt, data) {
let elt = evt.detail.elt;
# I prefer to serve documents using a document slug (derived from the title of the document) | |
# instead of using the filename, especially since filenames can become quite ugly (appended random strings). | |
# E.g. a file named 'campus_map.pdf' with titel 'Campus Map' may be uploaded as 'campus_map_asRfsgt.pdf' | |
# by Wagtail and is then served as e.g. '/documents/24/campus_map_asRfsgt.pdf' (if WAGTAILDOCS_SERVE_METHOD = 'serve_view'). | |
# However, it would look much nicer, if it was served as '/documents/24/campus_map/', which could | |
# also be a more persistent document url, i.e. it would not change if the document object was changed by | |
# replacing the file with a new version (e.g. 'campus_map_v2.pdf'). | |
# I could also shorten the URL to '/documents/campus_map/', omitting the id. However, lookups by id are | |
# much faster and we would need to ensure that these urls are unique. |
/// VERTICALLY ALIGN LABEL | |
/// Adds a pseudo-element to help vertically align | |
/// text labels in buttons/block-like links without | |
/// using magic numbers | |
/// More: https://ishadeed.com/article/button-label-alignment/ | |
@mixin vertically-align-label() { | |
&::before { | |
content: ''; | |
display: inline-block; | |
vertical-align: middle; |
const UpdateProcessWireFrontendContentUsingHtmxDemo = { | |
initHTMXXRequestedWithXMLHttpRequest: function () { | |
document.body.addEventListener("htmx:configRequest", (event) => { | |
// @note: ADD THIS!!! if not using hx-include='token input' | |
// const csrf_token = UpdateProcessWireFrontendContentUsingHtmxDemo.getCSRFToken() | |
// event.detail.headers[csrf_token.name] = csrf_token.value | |
// add XMLHttpRequest to header to work with $config->ajax | |
event.detail.headers["X-Requested-With"] = "XMLHttpRequest" | |
}) | |
}, |
class AddImage(LoginRequiredMixin, CreateView): | |
""" | |
adds a image | |
""" | |
form_class = ImageForm | |
model = Image | |
def get_template_names(self): | |
if self.request.htmx: |
You can find this feature in Settings > Download Twitter Archive. It might take 24 hours to receive.
Unzip the file and open the data
folder in your terminal:
cd ~/Downloads/twitter-archive-zip-you-downloaded/data
(I have seen reports that this function may no longer be working, so this guide is mostly useful to those who were lucky enough to already have downloaded their archive.)
...and obviously we're building a workaround. But I'm absolutely flabbergasted that a standard <input type="date">
HTML field, in a standard browser, from a company that bases its reputation good design, could be so dreadful.
I'm the developer for a startup that sells a genetic test to recommend medications for high blood pressure. For medical reasons we need to know our customers' birth date. Most of our customers are in their 60s or older. We've found that many of them use iPads or iPhones. And they're the ones who complain to our customer support that our site is unusable.
from django.db import models | |
from django.utils.translation import gettext_lazy as _ | |
class Person(models.Model): | |
""" | |
Store data about people in a school | |
""" | |
name = models.CharField(max_length=100) |
//@see https://codepen.io/localhorst/pen/dyqbboY | |
(function () { | |
'use strict' | |
if(location.hash){ | |
const triggerEl = document.querySelector(location.hash) | |
bootstrap.Tab.getOrCreateInstance(triggerEl).show() // Select tab by name | |
} | |
const selectableTabList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tab"]')) | |
selectableTabList.forEach((selectableTab) => { |
from django.http import HttpRequest, HttpResponse | |
from django.template.response import TemplateResponse | |
from render_block import render_block_to_string | |
def render_template_fragments( | |
request: HttpRequest, | |
template_name: str, | |
context: dict | None = None, | |
*, |