Re: Use of TIME_INPUT_FORMATS in TimeField

2024-03-05 Thread David Sanders
Define TIME_INPUT_FORMATS in your local formats.py setup as per: https://docs.djangoproject.com/en/5.0/topics/i18n/formatting/#creating-custom-format-files On Tue, 5 Mar 2024 at 18:43, Arthur Pemberton wrote: > The documentation ( > https://docs.djangoproject.com/en/5.0/ref/forms/fields/#timefie

Re: Potential bug with how Value works with Django ORM queries

2023-10-26 Thread David Sanders
Hi Nitin, Not sure what db you're using but will explain assuming PG. In this particular example, Django uses the `->` operator which requires that we compare jsonb types. The `__in=("Program1", "Program2")` is converted to jsonb via `DatabaseOperations.adapt_json_value()` where as `Value()`

Re: Proposing the removal of Oracle from the Django supported backend databases

2023-08-27 Thread David Sanders
I posted a thread a while back about the latest version of Oracle 23c which appears to add support for a few things that would fix some of the workarounds we have in the ORM (eg boolean expressions). I know dropping 19c is a long way off but at least the future is looking brighter 🌟 On Wed, 9 Aug

Re: Ticket #34646 Ordering a Django admin column based on multiple model fields

2023-06-18 Thread David Sanders
Sorry to clarify I intended to respond with "niche solution" not "nice solution" lol. I didn't realise the phone's autocomplete had done that. On Monday, 19 June 2023 at 11:05:41 UTC+10 David Sanders wrote: > Mariusz is a developer, so that's at least 1 dev

Re: Ticket #34646 Ordering a Django admin column based on multiple model fields

2023-06-18 Thread David Sanders
Mariusz is a developer, so that's at least 1 developer's opinion :) Unless anybody else pipes up to counter this I'd consider it to be a nice solution. On Monday, 19 June 2023 at 05:01:52 UTC+10 Mubarak Alrashidi wrote: > Can we at least know what the developers think about it? > > > On Sunday,

Re: Oracle 23c released earlier this month

2023-04-21 Thread David Sanders
Looks like python-oracledb is making updates to be compatible with 23c: https://python-oracledb.readthedocs.io/en/latest/release_notes.html#oracledb-1-3-1-tbd 1.3.1 isn't released yet but the fact that updates are being made so soon is encouraging 🎉 On Monday, 17 April 2023 at 22:06:57 UTC+10

Re: Django's automatic admin interface.

2023-04-19 Thread David Sanders
Hi Dipankar, Not being rude but serious question: What's the latest front end technology? :) On Wed, 19 Apr 2023, 7:27 pm Dipankar, wrote: > Is there any plan to replace Django's automatic admin interface with the > latest front end technology? > There are several packages available but what if

Oracle 23c released earlier this month

2023-04-17 Thread David Sanders
Hi folks, For anyone interested Oracle 23c was released earlier this month . There are a couple of interesting features but just looking over the changes it looks like it resolves some caveats that D

Re: Proposal: Check constraints at the model field level

2023-04-16 Thread David Sanders
Hi Adam, Mariusz & Simon, > The only thing I'm not a fan of in your proposal is repeating the field name within the check expression, like "price" in > ... 8< ... > Perhaps we could support only a special name instead, like “self” or the shorter “f”? I was thinking the same thing +1 I wanted to

Proposal: Check constraints at the model field level

2023-04-05 Thread David Sanders
Hi folks, We've had check constraints for a while now and they're awesome. I'd like to propose an alternative way to declare check constraints: at the field level. This sounds like it's duplicating the feature but there are some advantages that make this distinct from declaring at the model-level

Re: Issue with get_FOO_display not working in Django admin

2023-04-05 Thread David Sanders
At this point I'll let others chime in with their opinion on whether this is something that needs to change because: 1. I rarely use admin 2. I've never really had the need to override a choice's display over those supplied via `choices` :) On Wed, 5 Apr 2023 at 19:05, 'Ibrahim Abou Ele

Re: Issue with get_FOO_display not working in Django admin

2023-04-04 Thread David Sanders
Hi Ibrahim, get_FOO_display() isn't intended to be overridden like that, it's just a convenience method for use in templates/whatever that refers to the underlying flatchoices. For clarity, please see the documentation: https://docs.djangoproject.com/en/4.2/ref/models/instances/#django.db.models.

Re: GSOC 2023 Discussion and Feedback: Database-level Cascades

2023-03-29 Thread David Sanders
> > Thank you for your suggestion and nice implementation example. I would try > to include that approach too. > No, that was just an example of a workaround without any of the benefits of Django's emulation – the presence of a workaround often goes into determining whether it's worth working on a

Re: GSOC 2023 Discussion and Feedback: Database-level Cascades

2023-03-27 Thread David Sanders
Hi Akash, Database-level cascading deletes is a topic that has been discussed often since, well probably the dawn of Django 😁 From recollection the main issue isn't the implementation, it's getting it to play nicely with Django's cascading emulation. There are other tickets, but I believe this i

Re: InlineAdmin unable to delete object with read only primary key

2022-11-21 Thread David Sanders
Hi Gagan, Interesting quirk you've found there, it's possible it could be a bug though further digging may be required. A couple of interesting notes I found while fiddling with your example code: - If you press "Save and continue editing" there are unspecified form errors - Setting `ed

Re: Switch to a dropdown widget for ListFilter on admin

2022-11-03 Thread David Sanders
Hi Vasanth, What advantages does a dropdown have over simply placing the options there though? Typically these sorts of things have horrendous accessibility and make the code more complex. -- David On Fri, 4 Nov 2022 at 02:17, Vasanth Mohan wrote: > Hello, > > When there are multiple filters o

Re: Warning in documentation about filtering queryset in ClassBasedViews

2022-10-29 Thread David Sanders
Hi Daniel, I don't think a warning is necessary here as it's fairly standard Python. To explain: the timezone.now() is evaluated at module level – ie only once when the Python module is imported – which explains the behaviour that you're experiencing. If you like you can submit a documentation P

Re: Proposal: Add An in-memory data storage backend in Django

2022-10-20 Thread David Sanders
Hi, I may be missing some context here but is this something distinctly different from setting SQLite to use in-memory storage [1]? 🤔 [1] https://www.sqlite.org/inmemorydb.html David On Fri, 21 Oct 2022, 04:30 Paolo Melchiorre (paulox), wrote: > Hi all, > > there is a package that provide in-

Re: Proposal to add a flatten() to django.utils

2022-10-18 Thread David Sanders
> > +1 for that, though this will need some careful design between perf optimizations and how much general purpose it should be. Perhaps before optimising we could start out with the basic readable version and tailor it moving forward. It's possible this could be irrelevant if it's only ever use

Proposal to add a flatten() to django.utils

2022-10-16 Thread David Sanders
Hi folks, As part of PR 16175 there was some discussion around flattening lists/tuples as part of the solution. I proposed that if we create a flattening function that there'd be some benefit in sharing that in django.utils for other components if need

Re: Model-level validation

2022-10-01 Thread David Sanders
I'm not really interested in debating whether the ORM validates or not but I thought it might be worth pointing out a few things that haven't been touched on yet: > It's not right. Design decisions are often neither outright right nor wrong but more tradeoffs of varying values. > The data store

Re: Proposal: Make it so when getting an image's dimensions, EXIF orientation is considered

2022-09-28 Thread David Sanders
ould > be somewhat wasteful to add them to all ImageFields when few users will > care about the difference. > > On Mon, Sep 26, 2022 at 10:28 AM David Sanders < > shang.xiao.sand...@gmail.com> wrote: > >> Actually might as well throw out one idea, feel free to disc

Re: Proposal: Make it so when getting an image's dimensions, EXIF orientation is considered

2022-09-26 Thread David Sanders
width and height as is read from the image with the rotation as separate meta-data. (Eg I did a cursory look with Gimp & Preview on mac) On Mon, 26 Sept 2022 at 19:20, David Sanders wrote: > Coincidence I was also just reading up image-orientation… I didn't realise > that it's t

Re: Proposal: Make it so when getting an image's dimensions, EXIF orientation is considered

2022-09-26 Thread David Sanders
ep 24, 2022 at 5:51 PM Adam Taylor wrote: > >> Following the advice of David Sanders and Mariusz Felisiak, I'm coming >> here with my proposal rather than continuing on with the ticket system (see >> ticket >> #34035 <https://code.djangoproject.com/ticket/3403

Solutions for ticket #31506

2022-09-24 Thread David Sanders
Hi folks, Ticket 31506 is an older ticket that I thought I'd look into – there are a couple of points of discussion I thought I'd run past folks before offering a PR. To summarise the issue: On Postgres when you add or subtract an interval with a dat

Feature Request: Customisation of constraint error messages in forms

2022-09-19 Thread David Sanders
Hi folks, Please note this is partly an extension of some discussion in PR 16054 asking whether single-field unique or check constraints should raise field errors as opposed to non-field errors . As part of Django's new con

Re: UniqueConstraint validation error message conditional vs non-conditional

2022-09-12 Thread David Sanders
d be for a UniqueConstraint of this form? >>> >>> UniqueConstraint( >>> fields=["foo"], >>> name="unique_uppercase_foo", >>> condition=Q(test__upper=F("test")) >>> ) >>> >>> The develope

Re: UniqueConstraint validation error message conditional vs non-conditional

2022-09-11 Thread David Sanders
olving OR > and mixing transform comparison (e.g. a unique constraint only defined on > palindromes) > > Cheers, > Simon > > Le dimanche 11 septembre 2022 à 14:52:47 UTC-4, othnield...@gmail.com a > écrit : > >> nice one there >> >> On Sun, Sep 11, 2022

UniqueConstraint validation error message conditional vs non-conditional

2022-09-11 Thread David Sanders
Hi folks (and in particular Simon Charette), I had a bit of a gotcha moment when a custom unique constraint validation message disappeared when I added a condition to it. I won't raise a ticket for this because it looks intentional from the constraint validation PR, but I wanted to seek clarificat

Re: Django timing

2022-09-09 Thread David Sanders
Hi Pelumi, It's kind of you to offer code, however there is a similar functionality in contrib.humanize: https://docs.djangoproject.com/en/4.1/ref/contrib/humanize/#naturaltime Perhaps this does what you require? -- David On Fri, 9 Sept 2022 at 23:50, Bhuvnesh Sharma wrote: > Hi, > if you are

Check constraint validation with NULLs

2022-09-08 Thread David Sanders
Hi folks, I've noticed a difference in the way check constraint validation behaves compared to the way Postgres (assuming similar behaviour in other DBs) validates when dealing with NULLs. Given a model with a simple positive check constraint: class Test(Model): test = IntegerField(null=True

Re: Feature Request (have sample implemenation): ALL subquery

2022-08-24 Thread David Sanders
I'm no expert on how PG optimises queries but NOT EXISTS appears to produce the desired execution plan. My original rationale was to improve the readability and "solution accessibility" for lack of a better term. This all came about because a colleague couldn't figure out how to do it as a Djan

Feature Request (have sample implemenation): ALL subquery

2022-08-24 Thread David Sanders
Hi folks! I have a piece of low hanging fruit I'd like to suggest and contribute: ALL subqueries. Here's the PG docs on ALL subqueries but basically it causes the subquery expression to evaluate to true o

Re: More eyes on Check Constraints

2017-08-13 Thread David Sanders
Hi Ian, Interestingly enough I'd just recently written https://github.com/rapilabs/django-db-constraints based on Matt Schinckel's idea. I wrote that because although check constraints are great, I really wanted a way to supply any type of constraint - primarily composite foreign keys. I don

Admin Themes in 1.10

2016-05-08 Thread David Sanders
Ever since PR #5567 [1] (which is great, yay CSP) I've been concerned about the impact it will invariably have on admin themes going forward. By removing any inline JS, the various admin JS functionality is now initialized in the JS files where it is much harder to extend or change for an admin the

Help Text Per Model Field Choice

2016-05-08 Thread David Sanders
Hey all, I think it would be a greatly useful feature to be able to set help text for choices on a model field. For the default Select widget this would be rendered as the title attribute for each choice, which browsers show when you hover over a choice. This also makes it simple to render the he