Re: Stop QuerySet repr from executing queries

2022-04-21 Thread Ian Foote
I've been working on the Kolo debugging tool and as part of that I've also run into this issue. Generating unexpected queries when monitoring a django project was a nasty surprise. In Kolo's case I was also able to work around it with a monkeypatch, but not needing this would be a nice performance

Re: Improvements to the startproject template

2022-04-21 Thread Ian Foote
I want to add that I think either proposed change here would be an improvement and that I'd prefer not to see this idea die because of bikeshedding over the best option. Regards, Ian On Thu, 21 Apr 2022 at 19:21, ome chukwuemeka wrote: > I think this is a good suggestion! > > On Thu, Apr 21, 20

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-13 Thread Ian Foote
I think deprecating it is a good idea. I think it's actually a small footgun - I've seen it used to restrict access to non-admin functionality, when `user_passes_test` would be appropriate. In the case I found it, it made adding tests trickier than it should have been. Ian On Tue, 9 Mar 2021 at 2

Re: Proposed change in ORM model save logic

2021-10-15 Thread Ian Foote
Hi Barry, Based on this I'm cautiously in favour. You set out a good case, it's much easier to understand the "why" here than in the original ticket. I'd avoid the extra optimisation of accessing __dict__ directly though - if __set__ gains extra functionality, I'd prefer not to accidentally miss

Re: Improvements to the startproject template

2022-04-18 Thread Ian Foote
Hi Tim, This feels like a good idea to me. Regards, Ian On Mon, 18 Apr 2022 at 18:17, Tim Allen wrote: > Greetings, friends! > > I've issued a PR that makes two changes to the `startproject` template: > >- instead of putting configuration files such >as `settings.py`, `wsgi.py`, and th

More eyes on Check Constraints

2017-08-10 Thread Ian Foote
Hi all, I've been working on https://code.djangoproject.com/ticket/11964 to add support for Check Constraints to the Django ORM and migrations framework. My work can be found at https://github.com/django/django/pull/7615. I think the functionality is basically there, so what it really needs

Re: More eyes on Check Constraints

2017-08-13 Thread Ian Foote
s would be a > possibility as a future extension of your pull request? > > Cheers, > David > > > On Friday, August 11, 2017 at 4:15:26 AM UTC+10, Ian Foote wrote: > > Hi all, > > I've been working on https://code.djangoproject.com/ticket/11964 &g

Re: Prevent DateRangeField overlap in model?

2017-10-04 Thread Ian Foote
Hi Brylie, Laurence, I think it should be possible to do this using my Check Constraints work (https://github.com/django/django/pull/7615) or something built on top of it. I plan to get this work into shape so it can land in Django 2.1. I hope this helps, Ian On 03/10/17 10:40, Laurence Sonnenb

Re: OneToOneField not updating relationship with reverse relation after refresh_from_db()

2018-09-02 Thread Ian Foote
On 02/09/18 17:58, Shivam Jindal wrote: > I have the following model > > class Member(models.Model): >     user = models.OneToOneField(User, null=True, blank=True) > > *Operation sequence* > > m = Member.objects.get(id=4) # This objects has attached user > m.user # Print user objects successfull

Re: OneToOneField not updating relationship with reverse relation after refresh_from_db()

2018-09-02 Thread Ian Foote
On 02/09/18 19:59, Shivam Jindal wrote: > Hi Lan, > > *m.user.refresh_from_db()* is sam as  > > *u = m.user* > *u.refresh_from_db()* > > So If I am refreshing u, it should update all relationship and property > of *u*(including reverse relation). Should It not? > Hi Shivam, As far as I can te

Requiring sqlparse for sqlite introspection

2018-10-07 Thread Ian Foote
Hi all, On my pull request (https://github.com/django/django/pull/10406) refactoring how Django creates database constraints I introduced a dependency on sqlparse in the sqlite introspection code. This allows Django to correctly read information about constraints on sqlite, particularly the name.

Re: Widening participation (Thoughts from DjangoCon)

2018-10-26 Thread Ian Foote
Hi Carlton, I've had similar thoughts sitting in the back of my mind for at least a couple of months, so thank you for sharing this. I agree that finding tickets is one of the big problems here, both for new contributors and for sprint leaders. At Pycon UK I took on the role of sprint leader along

Re: Idea: Allow queryset.get() and queryset.filter() to accept a positional argument for implicit primary key filtering

2018-10-31 Thread Ian Foote
I'm not in favour of this, it's too implicit for my liking and I don't think any gains outweigh the increased complexity of implementation. Ian On Wed, 31 Oct 2018 at 19:04, charettes wrote: > My main concern with allowing extra args and kwargs to be mixed with the > proposed > pk arg notation

Re: Python string formatting

2018-11-01 Thread Ian Foote
I think {} formatting has some minor readability benefits. The symmetry of the braces makes it easier (imo) to see at a glance what is going to be interpolated. With % formatting the alphabetical characters can be obscured by other text in the string, especially if there's not a space after it. I'v

Re: Validation of m2m

2019-02-21 Thread Ian Foote
I don't think a new setting is the way to go. I'd prefer to add an attribute (validate_m2m = False?) to the CreateView and UpdateView classes that allows a developer to opt-in to the new behaviour when they need it. This is more flexible and still maintains backwards compatibility. Regards, Ian O

Re: Proposal to format Django using black

2019-04-13 Thread Ian Foote
I'm in favour. Not needing to think much about code style when writing code or when reviewing is very nice. Ian On Sat, 13 Apr 2019 at 13:52, Herman S wrote: > Hi. > > I propose that Django starts using 'black' [0] to auto-format all Python > code. > For those unfamiliar with 'black' I recommen

Re: Feature Request: Enabling hooking into the autodetector from a third-party app.

2019-04-14 Thread Ian Foote
Hi Emil, This is a very interesting idea and I find your use-case compelling. Adding support for custom triggers to Django itself would resolve your main use case this time but I also see value in a general solution that enables Django's third-party ecosystem. I think the next step is to open a n

Re: Add an optional parameter to values() that returns a nested dictionary for foreign keys

2016-08-25 Thread Ian Foote
I think the consensus here is to not add the extra commit, so I've closed the ticket as wontfix. (https://code.djangoproject.com/ticket/16735#comment:26) Ian On 20/08/16 15:24, Josh Smeaton wrote: Just as an additional data point - most expressions that accept strings internally convert them

Re: [Feature Request] Shorthand syntax for filtering aggregations

2017-04-12 Thread Ian Foote
Hi Tom, I really like the look of Count('emails').filter(unread=False) in the annotate call. Ian On 12/04/17 21:35, Tom Forbes wrote: > Hello, > At the Djangocon sprints I wanted to add support for a postgres specific > syntax for filtering aggregations, which is quite simple: MAX(something) > F

Re: Ticket 28087: Allow filtering and ordering with RawQuerySet

2017-04-21 Thread Ian Foote
Hi Dmitriv, I think you're running into https://code.djangoproject.com/ticket/27332. Unfortunately this isn't fixed yet, but there's a pull request, so it might land in 2.0: https://github.com/django/django/pull/7560 Ian On 21/04/17 19:41, Dmitriy Sintsov wrote: > If I understand correctly, LEFT