[Feature Request] Shorthand syntax for filtering aggregations

2017-04-12 Thread Tom Forbes
Hello, At the Djangocon sprints I wanted to add support for a postgres specific syntax for filtering aggregations, which is quite simple: MAX(something) FILTER (WHERE x=1). During this the sprints I was told that it would be good to support this for all databases, and it can be done using the

Re: [Feature Request] Shorthand syntax for filtering aggregations

2017-04-17 Thread Tom Forbes
ceived_date__lt=one_week_ago)), > ) > > > Cheers, > Simon > > [0] http://modern-sql.com/feature/filter > [1] https://pypi.python.org/pypi/django-aggregate-if > [2] https://code.djangoproject.com/ticket/11305 > > Le mercredi 12 avril 2017 17:31:44 UTC-4, Tom Forbes a

Re: A New Design for the "Congratulations!" Page

2017-04-18 Thread Tom Forbes
I'm not a core developer but I'd just like to say that your redesign looks amazing and is a big improvement. Even if this specific design is not acceptable I think it's a great idea to link to the tutorials/documentation from that page. I'm not a big fan of it loading the fonts from Google Fonts

Re: Automatic prefetching in querysets

2017-08-15 Thread Tom Forbes
Exploding query counts are definitely a pain point in Django, anything to improve that is definitely worth considering. They have been a problem in all Django projects I have seen. However I think the correct solution is for developers to correctly add select/prefetch calls. There is no general

Re: Automatic prefetching in querysets

2017-08-16 Thread Tom Forbes
Some quicker changes that have been brought up here could be implemented in the interim, like adding intelligent warnings. Someone brought up a great point about how the ORM hides most SQL terminology from the user, but still requires the knowledge of the difference between prefetch and select

Re: #28398: Allow management command invocation to suggest for incomplete commands?

2017-07-17 Thread Tom Forbes
Vlada: I think this is a great idea for improving the usability of manage.py, especially for newcomers. When I looked your current implementation used a simple 'in' to find suggestions, but this is not great for the most obvious/common use case: typos. I would strongly advocate for using the

Re: Future of the development server's auto-reloading

2017-07-24 Thread Tom Forbes
I was looking into refactoring the auto-reloading code and I wanted to gather some feedback. There is some potential to squash several bugs in one go[1][2][3]. To begin with we can get rid of the Jython specific code, Jython is 2.7 only at the moment and I don't think that will change soon.

Re: Django 2.0 Python version support (Python 3.6+ only?)

2017-08-08 Thread Tom Forbes
One of the biggest gains would be allowing third party packages to begin to add type hints, if we support 3.4 this won't happen for a while at least. Other gains, for Django and third party packages include: - code improvements using unpacking generalizations - speed improvements with

Re: Admin list view counting

2017-08-07 Thread Tom Forbes
w > the > user to specify the number of objects) would solve a whole lot of the rest > of > the problem. > > On Monday 07 August 2017 15:03:15 Tom Forbes wrote: > > This is a great idea. A related issue I've come across with the paginator > > is not being able to pass a

Re: Admin list view counting

2017-08-07 Thread Tom Forbes
This is a great idea. A related issue I've come across with the paginator is not being able to pass an explicit count into it. If you have a query set with expensive annotations that don't effect the count in any way it's very wasteful to include them in the count SQL statement (on top of general

Optimizing out unused annotations from count queries

2017-08-19 Thread Tom Forbes
Hello, I think there is potential room for improvement with how Django handles count() queries, specifically relating to annotations. Currently any annotations that are added to a queryset are included in the SQL statement that is generated in the count() query, including all joins and SQL

Re: Optimizing out unused annotations from count queries

2017-08-19 Thread Tom Forbes
h stricter rules (such as join types), but we could look at doing that separately if it was difficult. On Sunday, 20 August 2017 03:11:13 UTC+10, Tom Forbes wrote: > > Hello, > I think there is potential room for improvement with how Django handles > count() queries, specifically relating t

Re: Integrate dj-database-url into Django

2017-05-24 Thread Tom Forbes
My two cents: connection strings/database URI's are a feature I've sorely missed in Django. Built-in functionality to convert environment variables like DJANGO_DB_DEFAULT (or more generally DJANGO_DB_*key*) into the relevant DATABASE setting would make some deployment situations a lot simpler.

Re: Integrate dj-database-url into Django

2017-05-27 Thread Tom Forbes
; > where we create arbitrary [engine] values in an ad-hoc fashion? > > On 24 May 2017, at 21:21, Tom Forbes <t...@tomforb.es> wrote: > > My two cents: connection strings/database URI's are a feature I've sorely > missed in Django. > > Built-in functionality to conver

Re: Integrate dj-database-url into Django

2017-05-27 Thread Tom Forbes
Edit: DJANGO_SETTINGS_MODULE isn't relative, it will import any arbitrary module you give it. If we accept that then I think we are accepting the risk of imports via an attacker controlling environment variables whilst Django starts up? On Sat, May 27, 2017 at 8:49 PM, Tom Forbes <t...@tomforb

Re: Connecting to postgresql database

2017-05-25 Thread Tom Forbes
Hi Anthony, this mailing list is for the development of Django only. Please post questions like this to django-users or ask in the #django freenode IRC channel, and not in this mailing list. As for your issue: the exception message explains exactly what the issue is. Try running 'pip install

Transifex organisation

2017-05-16 Thread Tom Forbes
Hello, Is anyone responsible for managing the transifex organisation? A colleague of mine applied to join the Django organisation to contribute greek translations for the admin, but his application is currently pending and has been for a while. Are there any special requirements for joining the

Re: Default to BigAutoField

2017-06-10 Thread Tom Forbes
I really like the idea of a global configurable setting. One problem with a setting is that it's not always changeable, which settings kind of imply (IMO). Going from int->bigint is always possible, but going backwards may not be, nor might going from int->guid. I attempted an int->guid migration

Re: Default to BigAutoField

2017-06-09 Thread Tom Forbes
How would this work with generic foreign keys as well? Those migrations couldn't be automatic. On 9 Jun 2017 20:43, "Jacob Kaplan-Moss" wrote: > I think this would be a good improvement, and I'd like to see it. I've > been bitten by integers overflowing at least twice I can

Re: LiveServerTestCase change in Django 1.11 means can't run functional tests against external server?

2017-06-01 Thread Tom Forbes
Shouldn't A.url be a relative URL in this case? I agree the ticket should be re-opened though, we had some pains working around this, but it was surmountable. On 1 Jun 2017 15:31, "Francis Mwangi" wrote: please reopen the ticket, we are having a pain testing code that

Cython usage within Django

2017-05-21 Thread Tom Forbes
Hello, There was a very interesting talk at Pycon about using Cython to speed up hotspots in Python programs: https://www.youtube.com/watch?v=_1MSX7V28Po It got me wondering about possibly using Cython in selected places within Django. I realize since Django was first released the distribution

Re: Cython usage within Django

2017-05-21 Thread Tom Forbes
for us to adopt the engineering overhead of integrating Cython into Django’s runtime environment. Yours Russ Magee %-) On 21 May 2017, 2:59 PM -0700, Tom Forbes <t...@tomforb.es>, wrote: Hello, There was a very interesting talk at Pycon about using Cython to speed up hotspots in P

Re: New Feature: Allow password reset token to expire in under a day

2017-09-21 Thread Tom Forbes
ot just keep PASSWORD_RESET_TIMEOUT_DAYS and allow floats? Then >>>> you can just do 1/24 for an hour. >>>> >>>> On 21 September 2017 at 09:50, Eddy C <coupo...@chicheng.me> wrote: >>>> >>>>> I think Minute, with default value 30 or 60

Re: CONTRIBUTION TO DJANGO

2017-09-22 Thread Tom Forbes
Hey Heba, For a few popular packages on Github it could be as simple as making a merge request and changing their tox.ini or travis.yml file. Once the django 2.0 alpha is published on PyPi (sometime very soon) you could make a merge request to run the projects tests with the alpha, and inspect the

Re: New Feature: Allow password reset token to expire in under a day

2017-09-21 Thread Tom Forbes
It also seems odd to express it as seconds, it's often going to be a large value between an hour and several days and the lowest resolution for the value anyone would need is minutes. On 22 Sep 2017 01:29, "Tom Forbes" <t...@tomforb.es> wrote: > I would still vote for a tim

Re: There should be a way to make Templates substitution to raise an exception on error

2017-09-21 Thread Tom Forbes
You could perhaps emulate something like that with a template tag, couldn't you? @register.simple_tag(takes_context=True) def requires(context, *names): for name in names: if name not in context: raise RuntimeError('{0} is not in the template context'.format(name)) And in

Re: There should be a way to make Templates substitution to raise an exception on error

2017-09-21 Thread Tom Forbes
You could perhaps emulate that with a template tag, it seems it would be best if this was kept in the template rather than in some associated Python file: @register.simple_tag(takes_context=True) def requires(context, *names): for name in names: if name not in context:

Re: Having a MongoDB connector for Django

2017-09-15 Thread Tom Forbes
You're right for pointing out that some elements of a relational database can be emulated in a non relational one, like Mongodb. The in-python joins sound s bit scary though. However I would argue that if you find yourself needing such things your data is relational, and therefore a relational

Re: ConnectionResetError in test_closes_connection_without_content_length

2017-09-20 Thread Tom Forbes
I added this test for the keep-alive release blocker. It's possible that the exceptions raised in that test vary by OS at least on 3.4, the docs suggest that it should throw BadStatusLine instead. ConnectionResetError is also a correct exception to raise in that specific case, we should just add

Re: New Feature: Allow password reset token to expire in under a day

2017-09-21 Thread Tom Forbes
I think we shouldn't shoe-horn a timedelta into the existing setting, so my vote is with the second option, but I think a timedelta is much more readable than just an integer. Also, the existing 3 day timeout for password links is quite surprising from a security point of view. The consultants I

Re: django project avoid reload page where work algorithm

2017-10-07 Thread Tom Forbes
This is the mailing list for the development of Django itself, I would post this to the Django users mailing list instead if you want any answers to your question. It sounds like an ideal use case for celery though. On 8 Oct 2017 01:41, "Xristos Xristoou" wrote: I have a

Re: WOULD LIKE TO CONTRIBUTE TO DJANGO

2017-10-03 Thread Tom Forbes
Your idea about ignoring conflicts in bulk_create is a great idea, i've made a merge request that attempts to implements this. If anyone has any time to review it it would be much appreciated. I couldn't find a very elegant way of adding it though - Sqlite and mysql need something added just

Re: Having a MongoDB connector for Django

2017-09-08 Thread Tom Forbes
JSON support in postgres is a great middle ground for storing unstructured documents. I don't know the specifics of your application, but I would be surprised if a document orientated database is a perfect fit. The majority of such apps are semi-structured, where you have some relations but also

Re: Templates: __html__ method support

2017-09-26 Thread Tom Forbes
The problem with something more complex like yaml or json is it's not easy to combine the output. If those methods return a string, as in actual json, it's not easy to do anything with them (like combine them into an array or another object). YAML is also whitespace sensitive. If they return a

Re: bulk_create on Postgresql: on conflict do nothing / post_save signal

2017-09-28 Thread Tom Forbes
I've been in similar situations before, you can usually get away with using a single query to fetch existing records and only pass data that doesn't exist to bulk_create. This works great for a single identity column, but if you have multiple it gets messy. It seems all supported databases offer

Refactoring the autoreloader

2017-09-29 Thread Tom Forbes
Hello, I've been thinking on and off about how to improve the autoreloader implementation and I wanted to gather some feedback on potential solutions. For some background, Django uses a fairly basic autoreload implementation that simply polls the last modified time for loaded Python files once a

Re: Optimizing out unused annotations from count queries

2017-08-21 Thread Tom Forbes
> Interestingly enough, just doing a .filter(m2m_relation__foo='bar') might change the results Is that not because it's a filter? Would ". annotate(x=F('m2m_relation__foo'))" change the results in any way? Sorry if I'm not following. On 21 Aug 2017 06:58, "Anssi Kääriäinen"

Re: Add support for multiple file fields

2017-08-31 Thread Tom Forbes
(I wrote a reply earlier and sent it, but it appears to have disappeared into /dev/null. Apologies if it comes through at some later date.) It seems adding a multiple kwarg and retrofitting it onto the existing FileField might not be the best idea. It might cause confusion with existing FileField

Re: Refactoring the autoreloader

2017-10-07 Thread Tom Forbes
r delegating the polling to watchdog. [1] https://www.vagrantup.com/docs/synced-folders/nfs.html [2] https://pythonhosted.org/watchdog/api.html#module-watchdog. observers.polling Cheers, François On 09/29/2017 12:03 PM, Tom Forbes wrote: > Hello, > I've been thinking on and off about h

Re: models.CalculatedField feature

2017-11-16 Thread Tom Forbes
I think without client-side Python execution of these functions it greatly limits the use of this feature. In the cases I've seen you have a bunch of `qs.filter(age__gt=18)` scattered around everywhere and a separate `can_drink` function of property. Without the `can_drink` function returning the

RE: models.CalculatedField feature

2017-11-15 Thread Tom Forbes
SQLAlchemy has this, through a feature called Hybrid Attributes: http://docs.sqlalchemy.org/en/latest/orm/extensions/hybrid.html Every Django project i've worked on has had to tackle this problem, often poorly. You usually end up with an instance method and a kind of duplicate manager method, or

Re: Refactoring the autoreloader

2017-12-10 Thread Tom Forbes
ly about how >> the behavior changes and possible backwards incompatibilities. That said, >> the autoreloader is a dev tool. Changing it isn't going to break anyone's >> production. This makes the big-bang approach viable. >> >> Thanks for working on this! >> &g

Re: Proposal: security enhancements

2018-05-04 Thread Tom Forbes
Hey James, I think these ideas are fantastic. I used EmberJS for a project and the development server contained a built in CSP report URL which just printed what the browser sent to the console. This was very useful during development as you could immediately see CSP errors that were triggered

Re: A Django Async Roadmap

2018-06-04 Thread Tom Forbes
Hey Andrew, thank you for the very exciting proposal and the ongoing work on Django channels! There is a lot to consider here and some very interesting problems to work through - I’d love to help out wherever I can. Do we think async is worth going after? I think this is very much worth doing.

Re: A Django Async Roadmap

2018-06-05 Thread Tom Forbes
> Unfortunately even if you have context variables, you simply can't await inside of an attribute reference because there's a synchronous call in your stack. I even chatted to some Python core devs at PyCon US about this and we couldn't really think of a way out of this problem without some very

Re: Optionally using a custom queryset for Paginator and MultipleObjectMixin (ListView)

2018-06-30 Thread Tom Forbes
Are you sure it is the prefetches that is causing this? As Adam pointed out these are correctly ignored. Annotations however are not, which can cause unnecessary work and longer execution times. i.e: Book.objects.annotate(something=Max('pages__word_count')).count() We have enough information to

Re: Database agnostic EnumField

2017-10-20 Thread Tom Forbes
There is a maybe/someday ticket for this here: https://code.djangoproject. com/ticket/24342 If your interested you could work on adding this into Django through that ticket, it seems like an interesting idea. When removing an enum value, how do you handle existing records? Are all supported

Re: ease patching Django object behavior in another django packages

2018-01-10 Thread Tom Forbes
018 at 1:12:55 PM UTC-5, Sergey Glazyrin wrote: >> >> Btw, I see no way how do I use this auth_user.create_user_from_token to >> solve this problem. >> It uses django contrib auth get_user function, so the proper place is to >> to use django auth backend logic. >> >>

Re: ease patching Django object behavior in another django packages

2018-01-10 Thread Tom Forbes
jects About adding request to get_user, I don't like it because then all dependent of django projects will need to change backends, it would be worst for community середа, 10 січня 2018 р. 19:52:06 UTC+1 користувач Tom Forbes написав: > > I would be in favour of a mechanism to help with this u

Re: ease patching Django object behavior in another django packages

2018-01-10 Thread Tom Forbes
I think Tim’s assessment in the ticket is on point, a DjangoObjectBuilder would look very strange and out of place if included (it’s not particularly pythonic either). Seems like there might be a legitimate issue here (or maybe just bad designs in OpenStack?), but unless I’m misunderstanding

Adding a bulk_save method to models

2018-01-19 Thread Tom Forbes
Hello all, I’d love for some feedback on an idea I’ve been mulling around lately, namely adding a bulk_save method to Dango. A somewhat common pattern for some applications is to loop over a list of models, set an attribute and call save on them. This unfortunately can issue a lot of database

Re: Adding a bulk_save method to models

2018-01-22 Thread Tom Forbes
obably some useful things in there when considering the API and approach. Cheers, Neal On Friday, January 19, 2018 at 5:49:48 PM UTC, Tom Forbes wrote: > > Hello all, > > I’d love for some feedback on an idea I’ve been mulling around lately, > namely adding a bulk_save method to

Re: Integrate dj-database-url into Django

2018-02-04 Thread Tom Forbes
I spent some time working on this today and fixed up my branch that implements this. I think I’ve got a nice API that passes all of the dj-database-url tests. As there is a bit of database-specific shenanigans we have to perform on URLs I added a

Re: DEP Pre-posal: Re-Designing Django Forms

2018-02-05 Thread Tom Forbes
> Perhaps we should just be able to swap Forms with WTForms or another python library and bake in ElementUI, There are a plethora of UI frameworks with different tradeoffs, I really don't think Django sound pick one. However a stronger integration with the JS-build tools of the day like Yarn,

Re: Consider renaming `mark_safe` to `dangerously_trust_html` (etc)

2018-02-22 Thread Tom Forbes
What about just 'trust_html'? The dangerous part is quite context dependent (and a bit of mouth-full), but at the core you are trusting the HTML. Hopefully it follows that you should not trust html with user input that hasn't been escaped. On 22 Feb 2018 13:10, "Anthony King"

Re: Consider renaming `mark_safe` to `dangerously_trust_html` (etc)

2018-02-22 Thread Tom Forbes
'trust_html' - it's still similarly short but as Tom says it > implies more than 'mark_safe' does. > > On 22 February 2018 at 08:30, Tom Forbes <t...@tomforb.es> wrote: > >> What about just 'trust_html'? The dangerous part is quite context >> dependent (and a bit of mo

Re: #28398: Allow management command invocation to suggest for incomplete commands?

2018-02-16 Thread Tom Forbes
e.g. ./manage.py mgriate could print out a message > 'Assuming you meant migrate' and then continue executing migrate, not > sure if this is the best for Django though where commands can be > arbitrarily added by third party apps. > > > > On 17 July 2017 at 09:47, Tom Forbes <t..

Re: “Abusing BinaryField” warning about binary files in DB

2018-02-25 Thread Tom Forbes
Hey Antonie, Personally I’m quite against changing that warning. I have only ever seen one application where the use of an in-database file is appropriate and they where using the FILESTREAM type in SQL Server

Re: Integrate dj-database-url into Django

2018-07-28 Thread Tom Forbes
So in the PR I proposed I only bits I took verbatim from dj-database-url are the tests. The rest is re-implemented. I think it's a pretty good POC but I haven't touched it in a while. In any case we have to implement our own parsing for backends that do not support passing in a URL to the

Re: Django and Cython

2018-08-03 Thread Tom Forbes
The people showing you benchmarks comparing Django to ‘NodeJS’ are comparing apples to oranges. Django is not an asynchronous framework (yet!) so you cannot fairly compare the number of raw requests per second the two handle and present that as evidence one is better than the other. Each one has

Re: Add autocomplete attribute to contrib.auth fields?

2018-08-25 Thread Tom Forbes
I don’t have much to add other than it’s pretty common for pentests to flag autocomplete being enabled on sensitive fields (email/password) and recommend disabling it (autocomplete=off). While I’m not sure if I agree with that recommendation in some situations you have little choice but to follow

Re: Optionally using a custom queryset for Paginator and MultipleObjectMixin (ListView)

2018-07-17 Thread Tom Forbes
Indeed, I had an attempt at doing this here ( https://github.com/django/django/pull/8928/), but it seems a hard problem. I think there is huge potential here but I have no time to work on this anymore. On Tue, 17 Jul 2018, 19:00 Ramiro Morales, wrote: > On Sat, Jun 30, 2018 at 12:40 PM

Re: MariaDB, official support

2018-07-05 Thread Tom Forbes
I think that given Adams plan it might be possible to get this done before 2.2 as there are not too many failures. I’m not entirely convinced that including MariaDB logic inside the MySQL backend is a permanent solution. It might be the path of least resistance right now, and a good idea to get

Re: Shouldn't manage.py call python3 instead of python?

2018-04-08 Thread Tom Forbes
This only seems to be an issue when you are using the base system interpreter to run manage.py. installing Django and other dependencies there is not recommended for a variety of reasons, and this isn't a problem when using a virtualenv, it doesn't seem like there is much to fix IMO. On Sun, 8

Re: Shouldn't manage.py call python3 instead of python?

2018-04-08 Thread Tom Forbes
VirtualEnvs for each shell. So, I personally don’t use them anymore, and just use the base system now. I wish there was a process of running Django out-of-the-box from a default Mac OS install. -bobby On Apr 8, 2018, at 8:27 AM, Tom Forbes <t...@tomforb.es> wrote: This only seems to be an

Re: SafeExceptionReporterFilter should obfuscate all variables in every stack frame below a function decorated with sensitive_variables

2018-04-06 Thread Tom Forbes
My only concern is that it would greatly reduce the usefulness of the exception reporter, and might lead to people removing the sensitive_variables decorator in order to see exception tracebacks. Perhaps rather than obscure all local variables below the decorated function, we could obscure any

Re: please help me i am trying to solve it from 5 days but still did not get the solution so please help me here is problem

2018-04-15 Thread Tom Forbes
This mailing list is for the development of Django itself, not for support. Use the django-users mailing list for that, or IRC #django on freenode, or a site like Stack Overflow. On 15 April 2018 at 14:53:50, rahul verma (rahulverma6...@gmail.com) wrote:

Re: GSoC 2018

2018-03-16 Thread Tom Forbes
Hey Manasvi, I don't have any say in the choice of a GSOC student, but I'd like to add my two cents nonetheless. I can see the logic behind your proposal, but I'm skeptical about the usefulness of such a project. Libraries that implemented something similar to this have come and gone, and got

Re: GSoC 2018

2018-03-16 Thread Tom Forbes
another way of generating static server side HTML. Tom × 1. https://medium.com/@hpux/rails-5-1-loves-javascript-a1d84d5318b On 17 Mar 2018 03:14, "Manasvi Saxena" <msmana...@gmail.com> wrote: Hello Sir, On Saturday, March 17, 2018 at 5:39:34 AM UTC+5:30, Tom Forbes wrote: > Hey

Re: Remove pyinotify autoreloader support

2018-10-08 Thread Tom Forbes
ted a significant performance CPU and I/O improvement. Simon Le samedi 6 octobre 2018 15:32:33 UTC-4, Tom Forbes a écrit : > > What do we think about removing the pyinotify functionality in the > autoreloader? For context, if pyinotify is installed (Linux only) the > autoreloader will

Re: Python string formatting

2018-10-31 Thread Tom Forbes
In my experience f strings are vastly more expressive than .format, but not much better than % based formatting. If we can make this change after we drop 3.5 I think it will be a lot easier. On Wed, 31 Oct 2018, 21:09 Adrian Turjak There was a push to deprecated % formatting but too many people

Re: Widening participation (Thoughts from DjangoCon)

2018-10-26 Thread Tom Forbes
How much of this would you attribute to the current ticketing system itself, rather than tickets being tagged appropriately? I know when I started contributing I found trac to be pretty intimidating in terms of complexity, especially the search. I still prefer to use the 'Search Trac' field in

Explore integrating django-docker-box in some way?

2018-11-04 Thread Tom Forbes
Hello all, I’ve been working on a docker-compose based alternative to django-box (imaginatively named django-docker-box) over the last month and it finally appears to be mostly complete. For reference the tool is just a Dockerfile and a docker-compose definition that is able to run a complete

Re: Adding a database-agnostic JSONField into Django

2018-10-20 Thread Tom Forbes
Awesome work! Would you mind elaborating on the differences between mysql and mariadb? On Sat, 20 Oct 2018, 05:14 Raphael Michel, wrote: > Hi everyone, > > I used the sprints at DjangoCon US to work on this issue in form of a > third-party package. Mainly, I created a subclass of >

Re: Password reset token safety

2018-11-07 Thread Tom Forbes
Would you consider the *secret* key to not be unpredictable? On Wed, 7 Nov 2018, 21:22 Alex Toussaint > Hello, > > I'd like to discuss about Django's password reset token functionality. > > I've been able, with a simple Python script, from having read-only access > to my Django webserver to a

Re: Pluggable secret key backend

2018-11-11 Thread Tom Forbes
Is it going to be easy to adjust the semantics of SECRET_KEY to support sequences like that? I’d imagine a lot of third party packages that expect SECRET_KEY to be a string would break in weird ways (thanks to both strings and tuples of strings being iterables that yield strings). Here’s a quick

Re: backend specific tests

2018-11-07 Thread Tom Forbes
Hey Dan, I’ve been working on a project called django_docker_box ( https://github.com/orf/django-docker-box) that might help with this. Docker is pretty good at spinning up various databases without needing to clutter your local machine, spend time configuring authentication or dealing with

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

2018-11-05 Thread Tom Forbes
I feel this would be a good addition to just .get(), I’ve wanted this while working with the shell. Model.objects.get(pk) feels very natural to me, and the common Model.objects.get(pk=pk) always felt overly verbose. On 5 November 2018 at 22:37:52, Josh Smeaton (josh.smea...@gmail.com) wrote:

Re: Remove pyinotify autoreloader support

2018-11-04 Thread Tom Forbes
import Counter counter = Counter(m.split('.')[0] for m in sys.modules.keys()) total = sum(counter.values()) project_total = counter['PROJECT NAME HERE'] print('Project:', project_total) print('Total:', total) print(counter.most_common(20)) Thanks, Tom On 8 October 2018 at 12:04:08, Tom Forbes

Re: Adding a database-agnostic JSONField into Django

2018-10-04 Thread Tom Forbes
I would also be very interested in helping out. I don’t know if this is useful, but I’ve had a brief look at the feature support compared to our current baseline Postgres features: MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html - JSON_CONTAINS_PATH() can implement most

Remove pyinotify autoreloader support

2018-10-06 Thread Tom Forbes
What do we think about removing the pyinotify functionality in the autoreloader? For context, if pyinotify is installed (Linux only) the autoreloader will attempt to use it to detect file changes over the standard polling-based approach. It is generally much more efficient but is not cross

Re: Add Python 3.7 support for Django 1.11?

2018-11-16 Thread Tom Forbes
Do we have an idea of how many fixes would need to be backported? If it's just this one (or a very select few) I would support that. You can work around most things in Python but a hard syntax error is a big pain, so I can understand people wanting this. On 16 November 2018 at 15:24:44, Tim

Re: Request to reconsider ticket #27910: using an Enum class in model Field choices

2018-12-31 Thread Tom Forbes
ngo model (and form) fields. This > ticket was closed Wontfix because the original suggestion did not offer > any way to handle translated labels. However, after the ticket was > closed, Tom Forbes brought up a suggestion for a suitable API; > regretfully, AFAICT this suggestion was

Re: Request to reconsider ticket #27910: using an Enum class in model Field choices

2018-12-31 Thread Tom Forbes
made this much more usable. We currently have a -1 and a +1, does anyone else have any input on this? Tom On Mon, 31 Dec 2018, 22:15 Shai Berger Hi Tom, > > On Mon, 31 Dec 2018 18:26:14 + > Tom Forbes wrote: > > > I was describing my django-choice-object library[1]

Re: bulk_update: add **exclude** arg

2019-01-18 Thread Tom Forbes
Hey Mohammad, Thanks for your suggestion. I considered this while implementing bulk update but I decided against it. In my opinion you should be very explicit about the fields you wish to update, due to the way that bulk update works it can generate very large and expensive queries if a lot of

Re: Widening participation (Thoughts from DjangoCon)

2018-12-11 Thread Tom Forbes
> The only reason Github issues would be a consideration is if the group thought the onboarding experience (being where users already are with a tool they're already familiar with) would have more value than sticking with with the status quo which is strictly better from a feature perspective than

Re: A faster paginator for django

2018-12-23 Thread Tom Forbes
I would be strongly against misusing EXPLAIN like that inside Django, and I feel keyset/cursor pagination is best if your going down this road. I've got no concrete evidence for this opinion, but I feel like navigating to an exact page is very rarely used and only then as a proxy for range

Re: Widening participation (Thoughts from DjangoCon)

2018-12-12 Thread Tom Forbes
onboarding perspective. > > [0]https://www.python.org/dev/peps/pep-0581/#why-not-gitlab > > On Tuesday, 11 December 2018 23:20:21 UTC+11, Tom Forbes wrote: >> >> > The only reason Github issues would be a consideration is if the group >> thought the onboarding expe

Re: Explore integrating django-docker-box in some way?

2018-12-04 Thread Tom Forbes
November 2018 01:20:03 UTC+11, Tom Forbes wrote: > > Hello all, > > I’ve been working on a docker-compose based alternative to django-box > (imaginatively named django-docker-box) over the last month and it > finally appears to be mostly complete. > > For reference the t

Re: Explore integrating django-docker-box in some way?

2018-12-04 Thread Tom Forbes
environments would be. Florian, Tim, Markus .. any thoughts? (Apologies, I've missed some, this list of names is from memory). On Wednesday, 5 December 2018 10:39:16 UTC+11, Tom Forbes wrote: > > Thank you for the reply Josh. I didn’t anticipate any suggestions for > including this inside cor

Re: Removing Oracle from Django core in 3.0

2018-11-26 Thread Tom Forbes
a coffee! > https://calendly.com/codingjoe/coffee > > Lennéstr. 19 > 14469 Potsdam > > USt-IdNr.: DE284754038 > On 26. Nov 2018, 14:55 +0100, charettes , wrote: > > I haven't tried it out for Oracle yet but Tom Forbes' django-docker-box > seems to make it a not-too-pain

Re: Moving database backends out of the core

2018-11-26 Thread Tom Forbes
I see where you are coming from, but I'm not sure it will have the intended effect. One of the great things about Django is that for the most part database features work everywhere. If we split them out there will be more innovation, sure, but we may loose the 'database transparency' we currently

Re: Request to reconsider ticket #27910: using an Enum class in model Field choices

2019-01-12 Thread Tom Forbes
While I agree that Enum’s are a bit clunky (and IMO removing in is a poor choice), is this going to really take be that hard to work with or that difficult to validate? Enums are types that raise ValueError, like any other, so it’s not that confusing and fits in with Django’s existing validation

Re: Adding a bulk_save method to models

2018-09-15 Thread Tom Forbes
ss it though, > >> there is a package called django-bulk-update: > >> > >> https://github.com/aykut/django-bulk-update > >> > >> I've found it very useful on a number of occassions where update > >> isn't quite enough but the loop-edit-save patt

Re: Adding a bulk_save method to models

2018-09-16 Thread Tom Forbes
Thank you all for the feedback, I’ve changed the method to be bulk_update() as this seems to be the most liked option. Naming things is hard, and while bulk_update() isn’t perfect I think it’s a bit better than bulk_update_fields() or just update_fields(). On 16 September 2018 at 10:19:40,

Re: revisiting the Python version support policy

2019-01-25 Thread Tom Forbes
This message really resonated with me, especially after helping a few beginners get started with Python and watching them struggle with exactly this kind of thing. I'd be +1 on following Python. Looking through the diff there is not a huge amount of things to remove and IMO none of them are

Re: django.utils.dateparse

2019-02-03 Thread Tom Forbes
I’m pretty sure 0.0241 usec per loop is either a typo or a mistake during benchmarking. I’ve got no comment what you’re proposing but correct and valid benchmarks are important, so I would double check that. On 3 February 2019 at 23:37:14, Giuseppe De Marco ( giuseppe.dema...@unical.it) wrote:

Re: django.utils.dateparse

2019-02-04 Thread Tom Forbes
for your time and your attention. @Tom Forbes The first time I runned it I thought the same thing! Please use https://github.com/peppelinux/Django-snippets/blob/master/datetime_heuristic_parser.py and not the previous pasted one. I'm quite sure that all the tests passes well, because of their output

Re: BitBounce Spam Replies From the Mailing List

2019-02-17 Thread Tom Forbes
I figured I’d email their CEO (stewart.den...@bitbounce.com) and ask if he can look into this, because it’s kind of ridiculous. I think I should have known beforehand what kind of automated reply I got… I’ve also marked them as spam and so don’t receive them anymore but I can imagine it’s pretty

Re: Use CDN for djangoproject.com

2019-02-13 Thread Tom Forbes
I would highly recommend cloudflare. It's free, can be set up in 15 minutes and works really, really well. On Thu, 14 Feb 2019, 00:36 Cristiano Coelho, wrote: > Consider AWS's cloudfront then :) > > El martes, 12 de febrero de 2019, 2:34:09 (UTC-5), Florian Apolloner > escribió: >> >>

  1   2   >