Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ answer newbie questions, and generally made Django that much better:
Sachin Jat <sanch.jat@gmail.com>
Sage M. Abdullah <https://github.com/laymonage>
Sam Newman <http://www.magpiebrain.com/>
Sam Searles-Bryant <https://github.com/samueljsb>
Samruddhi Dharankar <sdharank@ics.uci.edu>
Sander Dijkhuis <sander.dijkhuis@gmail.com>
Sanket Saurav <sanketsaurav@gmail.com>
Expand Down
12 changes: 0 additions & 12 deletions django/contrib/admin/static/admin/css/responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -780,18 +780,6 @@ button {
overflow: visible;
}

.calendarbox:before,
.clockbox:before {
content: "";
position: fixed;
top: 50%;
left: 50%;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.75);
transform: translate(-50%, -50%);
}

.calendarbox > *,
.clockbox > * {
position: relative;
Expand Down
25 changes: 17 additions & 8 deletions django/contrib/admin/static/admin/css/widgets.css
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,13 @@ table p.datetime {
padding-left: 0;
}

.datetimeshortcuts button {
border: none;
background: none;
padding: 0;
cursor: pointer;
}

.datetimeshortcuts .clock-icon,
.datetimeshortcuts .date-icon {
position: relative;
Expand All @@ -360,8 +367,8 @@ table p.datetime {
background-size: 24px auto;
}

.datetimeshortcuts a:focus .clock-icon,
.datetimeshortcuts a:hover .clock-icon {
.datetimeshortcuts button:focus .clock-icon,
.datetimeshortcuts button:hover .clock-icon {
background-position: 0 -24px;
}

Expand All @@ -371,8 +378,8 @@ table p.datetime {
top: -1px;
}

.datetimeshortcuts a:focus .date-icon,
.datetimeshortcuts a:hover .date-icon {
.datetimeshortcuts button:focus .date-icon,
.datetimeshortcuts button:hover .date-icon {
background-position: 0 -24px;
}

Expand Down Expand Up @@ -426,7 +433,8 @@ span.clearable-file-input label {

.calendarbox,
.clockbox {
margin: 5px auto;
margin: 0;
padding: 0;
font-size: 0.75rem;
width: 19em;
text-align: center;
Expand All @@ -436,11 +444,12 @@ span.clearable-file-input label {
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
overflow: hidden;
position: relative;
position: absolute;
}

.clockbox {
width: auto;
.calendarbox::backdrop,
.clockbox::backdrop {
background: rgba(0, 0, 0, 0.75);
}

.calendar {
Expand Down
114 changes: 72 additions & 42 deletions django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
e.preventDefault();
DateTimeShortcuts.handleClockQuicklink(num, -1);
});
const clock_link = document.createElement("a");
clock_link.href = "#";
const clock_link = document.createElement("button");
clock_link.type = "button";
clock_link.id = DateTimeShortcuts.clockLinkName + num;
clock_link.addEventListener("click", function (e) {
e.preventDefault();
Expand Down Expand Up @@ -169,7 +169,7 @@
// Create clock link div
//
// Markup looks like:
// <div id="clockbox1" class="clockbox module" role="dialog"
// <dialog id="clockbox1" class="clockbox module" role="dialog"
// aria-label="Choose a time">
// <h2>Choose a time</h2>
// <ul class="timelist">
Expand All @@ -182,11 +182,9 @@
// <p class="calendar-cancel">
// <a href="#" role="button" aria-label="Close Clock">Cancel</a>
// </p>
// </div>
// </dialog>

const clock_box = document.createElement("div");
clock_box.style.display = "none";
clock_box.style.position = "absolute";
const clock_box = document.createElement("dialog");
clock_box.className = "clockbox module";
clock_box.id = DateTimeShortcuts.clockDivName + num;
clock_box.setAttribute("role", "dialog");
Expand Down Expand Up @@ -239,7 +237,7 @@
});

document.addEventListener("keyup", function (event) {
if (event.which === 27) {
if (event.key === "Escape") {
// ESC key closes popup
DateTimeShortcuts.dismissClock(num);
event.preventDefault();
Expand All @@ -261,25 +259,17 @@
} else {
// since style's width is in em, it'd be tough to calculate
// px value of it. let's use an estimated px for now
clock_box.style.left = findPosX(clock_link) - 110 + "px";
clock_box.style.right = findPosX(clock_link) - 110 + "px";
}
clock_box.style.top = Math.max(0, findPosY(clock_link) - 30) + "px";

// Show the clock box
clock_box.style.display = "block";
document.addEventListener(
"click",
DateTimeShortcuts.dismissClockFunc[num],
);
clock_box.showModal();
},
dismissClock: function (num) {
document.getElementById(
DateTimeShortcuts.clockDivName + num,
).style.display = "none";
document.removeEventListener(
"click",
DateTimeShortcuts.dismissClockFunc[num],
);
document
.getElementById(DateTimeShortcuts.clockDivName + num)
.close();
},
handleClockQuicklink: function (num, val) {
let d;
Expand Down Expand Up @@ -333,8 +323,8 @@
e.preventDefault();
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
});
const cal_link = document.createElement("a");
cal_link.href = "#";
const cal_link = document.createElement("button");
cal_link.type = "button";
cal_link.id = DateTimeShortcuts.calendarLinkName + num;
cal_link.addEventListener("click", function (e) {
e.preventDefault();
Expand Down Expand Up @@ -367,7 +357,7 @@
//
// Markup looks like:
//
// <div id="calendarbox3" class="calendarbox module"
// <dialog id="calendarbox3" class="calendarbox module"
// role="dialog" aria-label="Choose a Date">
// <div>
// <a href="#" class="calendarnav-previous"
Expand All @@ -391,10 +381,8 @@
// <p class="calendar-cancel">
// <a href="#" role="button" aria-label="Close Calendar">Cancel</a>
// </p>
// </div>
const cal_box = document.createElement("div");
cal_box.style.display = "none";
cal_box.style.position = "absolute";
// </dialog>
const cal_box = document.createElement("dialog");
cal_box.className = "calendarbox module";
cal_box.id = DateTimeShortcuts.calendarDivName1 + num;
cal_box.setAttribute("role", "dialog");
Expand All @@ -403,7 +391,46 @@
cal_box.addEventListener("click", function (e) {
e.stopPropagation();
});
// Handle arrow key navigation within the calendar
cal_box.addEventListener("keydown", function (event) {
const focused = cal_box.querySelector("a:focus");
if (!focused) return;
const cells = Array.from(cal_box.querySelectorAll("td a"));
const currentIndex = cells.indexOf(focused);
if (currentIndex === -1) return;

const ltr =
window.getComputedStyle(document.body).direction !== "rtl";
const forward = ltr
? event.key === "ArrowRight"
: event.key === "ArrowLeft";
const backward = ltr
? event.key === "ArrowLeft"
: event.key === "ArrowRight";
let nextCell = null;
const cellsPerRow = 7;

if (forward && currentIndex < cells.length - 1) {
nextCell = cells[currentIndex + 1];
} else if (backward && currentIndex > 0) {
nextCell = cells[currentIndex - 1];
} else if (
event.key === "ArrowDown" &&
currentIndex + cellsPerRow < cells.length
) {
nextCell = cells[currentIndex + cellsPerRow];
} else if (
event.key === "ArrowUp" &&
currentIndex - cellsPerRow >= 0
) {
nextCell = cells[currentIndex - cellsPerRow];
}

if (nextCell) {
event.preventDefault();
nextCell.focus();
}
});
// next-prev links
const cal_nav = quickElement("div", cal_box);
const cal_nav_prev = quickElement("a", cal_nav, "<", "href", "#");
Expand Down Expand Up @@ -521,7 +548,7 @@
DateTimeShortcuts.dismissCalendar(num);
});
document.addEventListener("keyup", function (event) {
if (event.which === 27) {
if (event.key === "Escape") {
// ESC key closes popup
DateTimeShortcuts.dismissCalendar(num);
event.preventDefault();
Expand Down Expand Up @@ -589,32 +616,35 @@
}
}

// Recalculate the clockbox position
// Recalculate the calendarbox position
// is it left-to-right or right-to-left layout ?
if (window.getComputedStyle(document.body).direction !== "rtl") {
cal_box.style.left = findPosX(cal_link) + 17 + "px";
} else {
// since style's width is in em, it'd be tough to calculate
// px value of it. let's use an estimated px for now
cal_box.style.left = findPosX(cal_link) - 180 + "px";
cal_box.style.right = findPosX(cal_link) - 180 + "px";
}
cal_box.style.top = Math.max(0, findPosY(cal_link) - 75) + "px";

cal_box.style.display = "block";
cal_box.showModal();
DateTimeShortcuts.updateNavAriaLabels(num);
document.addEventListener(
"click",
DateTimeShortcuts.dismissCalendarFunc[num],
const calendarDiv = cal_box.querySelector(
"#" + DateTimeShortcuts.calendarDivName2 + num,
);
if (calendarDiv) {
// Focus on selected date, today, or first available date
const focusElement =
cal_box.querySelector("td.selected a") ||
cal_box.querySelector("td.today a") ||
cal_box.querySelector("td a");
focusElement?.focus();
}
},
dismissCalendar: function (num) {
document.getElementById(
DateTimeShortcuts.calendarDivName1 + num,
).style.display = "none";
document.removeEventListener(
"click",
DateTimeShortcuts.dismissCalendarFunc[num],
);
document
.getElementById(DateTimeShortcuts.calendarDivName1 + num)
.close();
},
drawPrev: function (num) {
DateTimeShortcuts.calendars[num].drawPreviousMonth();
Expand Down
2 changes: 2 additions & 0 deletions django/contrib/gis/gdal/libgdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
elif os.name == "nt":
# Windows NT shared libraries
lib_names = [
"gdal313",
"gdal312",
"gdal311",
"gdal310",
Expand All @@ -38,6 +39,7 @@
lib_names = [
"gdal",
"GDAL",
"gdal3.13.0",
"gdal3.12.0",
"gdal3.11.0",
"gdal3.10.0",
Expand Down
11 changes: 11 additions & 0 deletions django/db/transaction.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from contextlib import ContextDecorator, contextmanager

from django.db import (
Expand All @@ -7,6 +8,7 @@
ProgrammingError,
connections,
)
from django.utils.deprecation import RemovedInDjango70Warning, django_file_prefixes


class TransactionManagementError(ProgrammingError):
Expand Down Expand Up @@ -46,6 +48,15 @@ def rollback(using=None):


def savepoint(using=None):
warnings.warn(
"savepoint() is deprecated. Use savepoint_create() instead.",
category=RemovedInDjango70Warning,
skip_file_prefixes=django_file_prefixes(),
)
return savepoint_create(using=using)


def savepoint_create(using=None):
"""
Create a savepoint (if supported and required by the backend) inside the
current transaction. Return an identifier for the savepoint that will be
Expand Down
4 changes: 2 additions & 2 deletions docs/howto/deployment/checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ If your site sends emails, these values need to be set correctly.

In development, email is often configured to be printed to the console or
stored in a local file. For production, you probably want to send real email
messages. See :ref:`topic-email-configuration` for more information about
setting :setting:`MAILERS` to use production email services.
messages. :ref:`topic-email-configuration` has more information about setting
:setting:`MAILERS` to use production email servers.

By default, Django sends email from ``webmaster@localhost`` and
``root@localhost``. However, many mail providers reject email from these
Expand Down
Loading
Loading