Re: Ticket #29015

2018-01-15 Thread Adam Johnson
Hi Priyansh, Aborting on creation with an informative message is probably wise. I'd say include as many details as you think relevant in the message, and it can be discussed more in review when there is a concrete message :) Thanks, Adam On 15 January 2018 at 12:50,

Re: Should ModelField.choices accept a callable?

2018-01-12 Thread Adam Johnson
I'd be more in favour of opting specific kwargs out of migrations, it keeps the interface simpler for users. There's a barrier to understanding Field(choices=func_that_returns_a_plain_list). As an note, Django-MySQL's EnumField uses the values in choices at the database layer to define an ENUM

Re: Fellow Report — January 12, 2018

2018-01-12 Thread Adam Johnson
 Welcome!  On 12 January 2018 at 17:04, Jacob Kaplan-Moss wrote: > Hooray, welcome Carlton! Looks like a great first week; glad to have you! > > Jacob > > On Fri, Jan 12, 2018 at 9:01 AM, Carlton Gibson > wrote: > >> Hi all, >> >> With help

Re: Change Local Memory Cache to Use LRU #28977

2018-01-10 Thread Adam Johnson
;> now marked as Accepted and Has patch. I've created a pull request at >>> https://github.com/django/django/pull/9555 Please review when able. >>> >>> Grant >>> >>> Ps. As always the docs are excellent. Even the docs for contributing are >>> extremely help

Re: Database session deletion

2018-01-05 Thread Adam Johnson
Hi George-Cristian, I agree, the 'clearing the session store' paragraph could be more explicit about what conditions sessions do get deleted. I encourage you to check https://docs.djangoproject.com/en/dev/internals/contributing/ , open a ticket, and make a PR with some updated wording :) I also

Re: Change Local Memory Cache to Use LRU #28977

2018-01-05 Thread Adam Johnson
I'm +1 for moving to LRU too, the eviction algorithm has always looked weird to me. And Josh's library shows there are valid uses of local memory caching in applications - perhaps moreso these days than when Django added caching and memcached was the latest thing. > You can also get a very nice

Re: UnicodeDecodeError at /manager/procesar_csv/ 'utf8' codec can't decode byte 0xd1 in position 0: invalid continuation byte

2018-01-04 Thread Adam Johnson
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 4 January 2018 at 16:01, Hernán Darío Zapata Villa wrote: > Good morning everybody > > I have

Re: Sealing or locking QuerySets -- a suggestion to prevent surprise N+1 queries.

2018-01-04 Thread Adam Johnson
1. I don't think the seal API on the QuerySet is enough, there are other ways implicit queries can be triggered without a QuerySet, e.g. Book(author_id=1).author . Shai's suggestion of using a query execution blocker is probably the best approach. If you were really worried you could even

Re: Add Request Timeout on API level

2017-12-26 Thread Adam Johnson
There isn't a native request timeout in Django, however you can configure your hosting WSGI server (at least gunicorn and uWSGI) to have a request timeout, and indeed it's recommended. I'm not sure how hard it would be to implement this (reliably, for all cases and platforms) inside Django. On 26

Re:

2017-12-26 Thread Adam Johnson
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 26 December 2017 at 00:01, Atef Ouerghi wrote: > I would like to retrieve the value of a

Re: Provide option to chain QuerySet.order_by()

2017-12-23 Thread Adam Johnson
Now you've said it, having both seems reasonable to me too :) On 23 December 2017 at 17:42, Shai Berger <s...@platonix.com> wrote: > On Tue, 19 Dec 2017 17:58:35 +0000 > Adam Johnson <m...@adamj.eu> wrote: > > > Fair. I agree it's more flexible, but it does mak

Re: Introduction : Somesh Chaturvedi

2017-12-21 Thread Adam Johnson
Welcome Somesh, There's actually a mailing list dedicated to first time contributors, where you might get a bit more attention: https://groups.google.com/forum/#!forum/ django-core-mentorship I'd suggest having a particular goal in mind where you'd like to contribute - what areas of Django do

Re: Provide option to chain QuerySet.order_by()

2017-12-19 Thread Adam Johnson
8 December 2017 at 21:33, Shai Berger <s...@platonix.com> wrote: > >> On Fri, 15 Dec 2017 21:01:39 + >> Adam Johnson <m...@adamj.eu> wrote: >> >> > I would prefer the QuerySet method than documenting parts of Query - >> > QuerySet shouldn't have to ma

Re: Provide option to chain QuerySet.order_by()

2017-12-19 Thread Adam Johnson
> On Fri, 15 Dec 2017 21:01:39 + > Adam Johnson <m...@adamj.eu> wrote: > > > I would prefer the QuerySet method than documenting parts of Query - > > QuerySet shouldn't have to make guarantees that its interactions with > > Query won't change, plus making Query i

Re: Hello everyone I'm a new member

2017-12-18 Thread Adam Johnson
Please don't do that, as I recall we'll just delete django.utils.six after the minimum recommended django version for third party libraries is 2.0. On 18 December 2017 at 15:05, wrote: > Hello Asad, > > as a first task you can remove the Python2-specifics from >

Re: Provide option to chain QuerySet.order_by()

2017-12-15 Thread Adam Johnson
I would prefer the QuerySet method than documenting parts of Query - QuerySet shouldn't have to make guarantees that its interactions with Query won't change, plus making Query in some way a public API could hamper features. Plus the amount of code is small and contained. Also I think worrying

Re: Hello everyone I'm a new member

2017-12-13 Thread Adam Johnson
Link: https://docs.djangoproject.com/en/dev/internals/contributing/ On 13 December 2017 at 06:49, ludovic coues wrote: > There is a chapter in the documentation on how to contribute to django. It > should answer most of your questions. > > On 13 Dec 2017 3:10 am, "Asad Ahmed"

Re: Provide option to chain QuerySet.order_by()

2017-12-11 Thread Adam Johnson
Seems like a good idea to me, I've been in a similar situation before and had to work around this part of QuerySets. On 11 December 2017 at 21:10, Markus Holtermann wrote: > Hi all, > > I'm in the situation where I'd like to join two .order_by() calls on a > QuerySet

Re: Removing ORM's union restrictions

2017-12-09 Thread Adam Johnson
Afraid I can't say as to whether you're missing anything, but I can say that MySQL/MariaDB support LIMIT/OFFSET it in the combined queries, so if this were implemented it would be nice to not add the SELECT * wrappers for the MySQL backend - there does seem to be a performance impact there, as the

Re: Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Adam Johnson
https://github.com/jsocol/django-ratelimit is good at this, and it's well maintained so you shouldn't have any problems with upgrading. It's already tested on Django 2.0. I agree though that it would be best for security if contrib.auth did it out of the box. But there are lots of reasons why

Re: Template variable resolution on objects that are no mappings but implement __getitem__

2017-11-10 Thread Adam Johnson
> > so it may only be to be explained that the implementation > of an object that they are using is wrong in regards to the mentioned > PEP 3119. PEP 3119 does say that ABC's are "not the end of ducktyping": https://www.python.org/dev/peps/pep-3119/#abcs-vs-duck-typing . As I understand it,

Re: Template variable resolution on objects that are no mappings but implement __getitem__

2017-11-10 Thread Adam Johnson
> > there are classes in the Pythoniverse that implement a __getitem__ method > for the sake of syntactical sweetness, but they are no mappings. My understanding of what ducktyping means is that by implementing __getitem__ such objects are declaring they are mappings. I'm -1 on this change

Re: Allow SessionStore's to be easily overridden to make dynamic the session cookie age

2017-11-06 Thread Adam Johnson
You linked to the wrong PR, here's the right one: https://github.com/django/django/pull/9318 I think Tim's middleware solution isn't that bad, it has the advantage that you can do a lot more logic there too, like use other attributes of request. Plus it works on current Django releases. That

Re: Contributing to Django

2017-10-31 Thread Adam Johnson
https://docs.djangoproject.com/en/dev/internals/contributing/ has a guide on getting starting contributing to Django, whether working on the code, the tickets, or just the community. On 31 October 2017 at 09:28, Harsh vardhan sharma < harshavardhana@gmail.com> wrote: > Hi everyone, > > I am

Re: MariaDB, official support

2017-10-30 Thread Adam Johnson
Hi Claude Afraid I haven't made any progress, I don't get to contribute to Django at work these days which has slowed me down :( So the sketchy plan I've had in my mind for some time is: 1) Get testing with all supported MariaDB versions (currently 5.5, 10.0, 10.1, 10.2) into Django CI, and fix

Re: PostgreSQL Partial Indexes package

2017-10-08 Thread Adam Johnson
It looks to me that the same trick on Oracle can be used on MySQL/MariaDB - indexing a generated column. There's a comment on https://mariadb.com/kb/en/library/generated-columns/ to that effect. P.S. Drizzle is long dead, the site isn't even up any more :) On 8 October 2017 at 12:38, Tim Allen

Re: WOULD LIKE TO CONTRIBUTE TO DJANGO

2017-10-03 Thread Adam Johnson
Also you posted this in https://groups.google.com/forum/#!msg/django-developers/r7JP_YHsIhM/jmof68XFBAAJ . Please don't repost, keep the conversation in one place. On 3 October 2017 at 17:00, Aymeric Augustin < aymeric.augus...@polytechnique.org> wrote: > Hello, > > Since I haven't seen positive

Re: about ticket 28588- has_perm hide non-existent permissions

2017-09-25 Thread Adam Johnson
I agree with Shai's comment on the ticket, changing it to raise a DoesNotExist when DEBUG=True. I think it's an acceptable compromise between backwards compat and helping find bugs. On 25 September 2017 at 11:56, Dan Watson wrote: > Seems like maybe it would be more helpful

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

2017-09-22 Thread Adam Johnson
I've used a solution like the one Emil links to before to great success, though perhaps there's scope to make it a bit less hacky in Django. On 22 September 2017 at 07:10, Emil Stenström wrote: > It as actually possible, just in a very hacky way. Django has a setting > called

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

2017-09-22 Thread Adam Johnson
;>> I think it makes sense to use PASSWORD_RESET_TIMEOUT. For timedelta >>>>>> vs. integer seconds. Timedelta has the benefit of readability, but >>>>>> integer >>>>>> has the benefit of simplicity. I think in SETTINGS everything should

Re: CONTRIBUTION TO DJANGO

2017-09-21 Thread Adam Johnson
There's a whole documentation page on this: https://docs.djangoproject.com/en/dev/internals/contributing/ There aren't many easy pickings tickets, plus most of the effort right now is being put into features for the 2.0 feature freeze. I'd suggest the biggest contribution you can make right now

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

2017-09-21 Thread Adam Johnson
Why not 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 wrote: > I think Minute, with default value 30 or 60, is the best unit for this > setting. > > 3 minutes (even 1) is short enough

Re: ConnectionResetError in test_closes_connection_without_content_length

2017-09-20 Thread Adam Johnson
Hi Zhiqiang It's hard to tell what the problem is with more details. From your traceback it looks like you're running Python3.4 on MacOS but there's no indication of your database or other settings. If you run the tests on the 1.11 branch, does it pass? If so, you can bisect to find the

Re: Deprecating CachedStaticFilesStorage in Django 2.0

2017-09-15 Thread Adam Johnson
(For some reason GMail is clipping your message before any content, I only saw '... [Message clipped]' and had to click to see it all) I'm not that familiar with the static file storages, but it seems to me like it's not going to be that controversial deprecate it in order to save this

Re: Having a MongoDB connector for Django

2017-09-10 Thread Adam Johnson
> > That's a bit ridiculous, because now I have to reinvent Django ORM, > contrib packages and everything under the sun. > Django can work with DBs that support or don't support transactions. I don't know where you get the impression that Django can work with transactionless DB's from. Many

Re: Having a MongoDB connector for Django

2017-09-08 Thread Adam Johnson
I agree, I think forcing Django's ORM to work on MongoDB is not a great idea. Django relies heavily on transactions and other relational goodness. Have you tried storing JSON in your Postgres/MySQL database? Django can work with that with contrib.postgres/django-mysql  On 8 September 2017 at

Re: Easy pickings are not that easy for a new contributor

2017-09-05 Thread Adam Johnson
There are also some other repos in the Django organization on GitHub that could do with some love: https://github.com/django . For example localflavor and formtools, which were removed from Django core, still have some users and you might something to work on there. On 5 September 2017 at 15:06,

Re: Custom Join Conditions

2017-09-05 Thread Adam Johnson
mporting the class > FilteredRelation ? > From its current location ? > > from django.db.models.query import FilteredRelation > > or from its parent module ? > > from django.db.models import FilteredRelation > > as it seems to be the django way. > > Best, > Nicolas > >

Re: Custom Join Conditions

2017-09-04 Thread Adam Johnson
The annotate(foo=FilteredRelation(...)) API LGTM too, and yes I agree on the rationale on alias over to_attr. On 4 September 2017 at 10:25, Anssi Kääriäinen wrote: > I really like the .annotate() version. The way this feature works with > .annotate() is easy to understand if

Re: Custom Join Conditions

2017-09-02 Thread Adam Johnson
I think filter_related is a good name, it's not that confusing that it sounds like select_related / prefetch_related. The current name is a bit weird because it's an adj + noun, it doesn't really say how it *modifies* the QuerySet, it sounds more declarative. to_attr is also better, as it aligns

Re: Add support for multiple file fields

2017-09-02 Thread Adam Johnson
I agree with Melvyn on the first point. I don't think Django should include model fields that encourage denormalization by default (apart from JSONField etc which are built into the DB). A forms.MultiFileField would make sense but to make storage easy it should somehow translate into multiple

Re: Default to BigAutoField

2017-08-31 Thread Adam Johnson
s SmallIntegerField. Did I miss the discussion about the benefits of the > rename? If we agree to proceed with it, please split it out into a separate > ticket/PR for easier review. > > On Sunday, August 27, 2017 at 5:31:47 AM UTC-4, Adam Johnson wrote: >> >> I don't t

Re: drop support for MySQL 5.5 in Django 2.0?

2017-08-31 Thread Adam Johnson
Collin, it's also not hard to install MySQL 5.6 from Oracle on Ubuntu 14.04 ;) Tim, the commit to clean up MySQL 5.5 isn't very big, especially if you put back in the supports_microsecond_precision code. I'm not sure dropping it "prematurely" is that helpful, considering that GIS is rarely used

Re: Default to BigAutoField

2017-08-27 Thread Adam Johnson
I don't think "primary key size" is something that's even within consideration for 99% of django apps. Sure a few more bytes are going to be wasted here, but you could argue the same that the default AutoField was already too big for most models that have 100's of instances and could use even a

Re: Feature request: Allow to process data-migrations after flush

2017-08-26 Thread Adam Johnson
I've always thought flush is a weird command because an empty database is very normally useless, because of data migrations. The docs do even say: If you would rather start from an empty database and re-run all migrations, > you should drop and recreate the database and then run migrate instead.

Re: Optimizing out unused annotations from count queries

2017-08-21 Thread Adam Johnson
I'm not sure how much QuerySet optimization django should really be doing. Databases' optimizers are really good and as we've seen there are a huge number of edge cases in trying to do the work in Djangoland, as QuerySets don't really correspond to the underlying data model. Here's an example in

Re: Should django File wrapper support .next()?

2017-08-18 Thread Adam Johnson
rned by open(). > > > El martes, 15 de agosto de 2017, 19:21:08 (UTC-3), Adam Johnson escribió: >> >> The next() method is gone from the return value of open() in Python 3 >> and I don't think it was every necessary. As per the iterator protcool ( >> https://docs.py

Re: Automatic prefetching in querysets

2017-08-16 Thread Adam Johnson
> > I wouldn't want is to give free optimisations to non-ORM pros > Something like 99% of django projects are by non-ORM pros, it can be easy to forget that on a mailing list of experts. On 16 August 2017 at 12:27, Josh Smeaton wrote: > It won't affect experienced

Re: Automatic prefetching in querysets

2017-08-15 Thread Adam Johnson
ming that it's completely *unlikely*. On 15 August 2017 at 23:24, Adam Johnson <m...@adamj.eu> wrote: > Adam/Gordon, I'm interested in hearing how these changes led you to >> discovering stale prefetches? > > > We removed all the manual prefetches in admin get_queryset(

Re: Automatic prefetching in querysets

2017-08-15 Thread Adam Johnson
erator()` queries (that can't use prefetch) > - Could we warn of reverse M2M/ForeignKey at least? > > Adam/Gordon, I'm interested in hearing how these changes led you to > discovering stale prefetches? > > On Wednesday, 16 August 2017 07:30:10 UTC+10, Adam Johnson wrote: >> &

Re: Should django File wrapper support .next()?

2017-08-15 Thread Adam Johnson
The next() method is gone from the return value of open() in Python 3 and I don't think it was every necessary. As per the iterator protcool ( https://docs.python.org/2/library/stdtypes.html#iterator-types ), __iter__ is meant to return an iterator over the object, and *that* is what the next()

Re: Automatic prefetching in querysets

2017-08-15 Thread Adam Johnson
I'm biased here, Gordon was my boss for nearly three years, 2014-2016. I'm in favour of adding the auto-prefetching, I've seen it work. It was created around midway through last year and applied to our application's Admin interface, which was covered in tests with *django-perf-rec*. After adding

Re: Oracle sequence naming regression - input on approach?

2017-08-12 Thread Adam Johnson
Considering the number of people using Oracle is small, and those using the non-default for use_returning_into should be smaller, and that it sounds like the sequence naming logic doesn't sound super different, and that 1.11 hasn't been out for *that* long, relatively, it sounds like option 1 is

Re: Admin list view counting

2017-08-09 Thread Adam Johnson
FYI Django-MySQL supplies an approx_count() method: https://django-mysql.readthedocs.io/en/latest/queryset_extensions.html#django_mysql.models.approx_count . It only works on QuerySets without filters. From what I understand it's possible to get an estimate for filtered queries in MySQL in *some*

Re: [feature request] including HttpResponse(status=204) as an HttpResponse subclasses

2017-08-07 Thread Adam Johnson
ses to Django, unless perhaps, they add some additional functionality > as HttpResponseNoContent does. > > Did you intend to have response subclasses for all 57 values of > http.HTTPStatus? > > On Sunday, August 6, 2017 at 4:17:22 PM UTC-4, Adam Johnson wrote: >> >> I've mad

Re: Admin actions.js performance

2017-08-07 Thread Adam Johnson
I've made a ticket here: https://code.djangoproject.com/ticket/28472#ticket . You can follow https://docs.djangoproject.com/en/dev/intro/contributing/ to make a Pull Request on GitHub against this ticket  On 7 August 2017 at 09:19, ecas wrote: > Is there any way to

Re: Admin list view counting

2017-08-07 Thread Adam Johnson
+1 from me, I've spent long enough on those COUNT(*) queries at work. Is it worth putting this logic in Paginator so applications can reuse it? On 7 August 2017 at 07:45, Josh Smeaton wrote: > The admin list page performs a count(*) (twice!) when viewing the list > page

Re: [feature request] including HttpResponse(status=204) as an HttpResponse subclasses

2017-08-06 Thread Adam Johnson
I've made a ticket for this: https://code.djangoproject.com/ticket/28469 On 7 April 2017 at 11:18, Berker Peksağ <berker.pek...@gmail.com> wrote: > On Fri, Apr 7, 2017 at 9:54 AM, Adam Johnson <m...@adamj.eu> wrote: > > Personally I'd be in favour of adding such clas

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

2017-07-17 Thread Adam Johnson
I feel like this mostly duplicates the bash completion logic we have, which is also more standard across other CLI's However I agree with Tom that correcting for typos is the main use case, using levehshtein distance is a good idea. Another thing that some CLI's have, like npm or arc is

Re: Django annotation and Implementation for group by every two hours

2017-07-11 Thread Adam Johnson
Hi, this is the wrong list for questions about using Django, the right list for that is https://groups.google.com/forum/#!forum/django-users . This list is for discussing the development of Django itself. On 10 July 2017 at 17:15, kanhaiya yadav wrote: > Enter code

Re: About migrations

2017-07-07 Thread Adam Johnson
Docs link: https://docs.djangoproject.com/en/1.11/howto/writing-migrations/#controlling-the-order-of-migrations On 7 July 2017 at 22:53, Andrew Godwin wrote: > There is already a run-before constraint you can add to migrations for > exactly this purpose! It's called

Re: Follow-up to #28307: Possible app_template improvements

2017-06-15 Thread Adam Johnson
I agree with Aymeric and Curtis too. You could distribute your startapp template as a third party package, even overriding the built startapp manage command to use your template by default. On 15 June 2017 at 07:16, Curtis Maloney wrote: > > > On 15/06/17 16:14, Aymeric

Re: DEP201 / Simplified URL routing progress report

2017-06-13 Thread Adam Johnson
For those who don't know, the PR is here: https://github.com/ django/django/pull/7482 > However, in doing so I "had" to get rid of a minor performance > optimisation: the caching of `.regex` using LocaleRegexDescriptor, so there > might be a performance drawback in case one does not use the >

Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-04 Thread Adam Johnson
I've made a pair of PR's, one for Django master and one for the 1.11 branch. On master, which is Python 3+, getattr_static is used . https://github.com/django/django/pull/8599 https://github.com/django/django/pull/8601 On 3 June 2017 at 01:02, Carl Meyer wrote: > Hi Zack, >

Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-02 Thread Adam Johnson
This is my bad, I did the refactoring :) You're right, the original version did in fact use a try..except AttributeError and that should be preserved for cases like this.

Re: Tabs in Django Admin forms?

2017-06-02 Thread Adam Johnson
I agree, it sounds like feature creep to me. It could probably be provided by code in a third party package too, the admin is very extensible. On 2 June 2017 at 16:42, Tim Graham wrote: > I think Django can't reasonably add every feature under the sun to the > admin. If

Re: Make bool(AnonymousUser) evaluate to false

2017-06-01 Thread Adam Johnson
> > On the other hand, maybe it's a good idea to report a warning in the > __bool__ method? In most cases, bool(AnonymousUser) is a programming error, > and not a valid code, so this might be helpful. > bool(AnonymousUser) is very pythonic, not a "programming error". The rules for python's

Re: Django db backend not FIPS compliant

2017-05-31 Thread Adam Johnson
After googling a bit I found this CPython ticket: https://bugs.python.org/issue9216 . It turns out that the block is in OpenSSL and not really python land. They didn't find a solution to it in the standard library on that ticket, but I think it should be pretty easy to monkey patch in a pure

Re: Make bool(AnonymousUser) evaluate to false

2017-05-31 Thread Adam Johnson
I'm afraid I'm -1 on this. We already have if request.user.is_authenticated and request.user.is_anonymous which are both more explicit and pythonic. Additionally all python classes, and thus instances of User atm, are by default truthy, so implementing this custom __bool__ introduces space for

Re: migration lock file implementation

2017-05-25 Thread Adam Johnson
I agree, it really depends on your project's workflow and organization as to how often you see migration conflicts and whether this is the right way to show them to users. Creating lock files in django core would just add confusion for 99% of projects. On 24 May 2017 at 23:03, Florian Apolloner

Re: Django and CSP strict-dynamic

2017-05-22 Thread Adam Johnson
> > I agree; note however, that nonces are part of CSP Level 2, which is in > "W3C Recommendation" status Ah, I am not familiar with all these standards, thanks for clarifying. The first part I think Django should be involved in in generating the nonce > (a simple base64(os.random(16)) and

Re: Cython usage within Django

2017-05-22 Thread Adam Johnson
FYI a colleague and I tried Cythonizing parts of django.template in 2015, we shared our findings on this list: https://groups.google.com/forum/#!topic/django-developers/CKcZwC3J1eQ . We didn't build it in Django core or a fork, our package replaced parts of Django as they imported using an import

Re: Why was CommaSeparatedIntegerField Deprecated?

2017-05-15 Thread Adam Johnson
I agree with the removal, it wasn't providing much value and was making it unclear as to what it actually aws. It could easily be mistaken by a beginner for a performant alternative to M2M models or something like django.contrib.postgres' ArrayField. Additionally it was weird that Django would

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Adam Johnson
The problem with (a) - data with null bytes in strings from other databases can't be loaded into PG as per #28117 . The problem with (b) - data currently in databases in the wild will be modified upon save  (b) is incredibly destructive and could break an unknown number of applications whilst

Re: Project report: Test infrastructure and property-based tests for Channels

2017-05-15 Thread Adam Johnson
Nice one!  Happy to see more Hypothesis tests, I've had great experience with it too. On 15 May 2017 at 11:54, wrote: > Hi everyone, > > I did some work on Channels' tests and testing infrastructure as part of > the Mozilla grant. This is my report. > > Channels consists

Re: Django and CSP strict-dynamic

2017-05-15 Thread Adam Johnson
Hi Ran Given that it's still a W3C draft I am not sure it should be added to Django core yet. I don't know of any official policy around what Django implements versus the W3C spec levels though. However it does seem that without a centralized solution for CSP nonces, they won't be usable with

Re: Proposal: django.contrib.mysql

2017-05-10 Thread Adam Johnson
ially supported code". On 10 May 2017 at 13:43, Sérgio Basto <ser...@gmail.com> wrote: > > > On Monday, May 8, 2017 at 4:22:04 PM UTC+1, Adam Johnson wrote: > >> Sérgio, django-mysql already fully supports MySQL 5.7's JSON type with >> its JSONField: https:/

Re: raise error for form attribute

2017-05-10 Thread Adam Johnson
clean() and non_field_error both seem like the wrong place since they happen after the first rendering of the form. You should be able to raise it on initialization, no? On 10 May 2017 at 10:19, Naveen Yadav wrote: > Hi, > > I am working on my first issue >

Re: Proposal: django.contrib.mysql

2017-05-08 Thread Adam Johnson
May 2017 at 18:41, johannes mtwengi <johannesmtwe...@gmail.com> wrote: > i would like to be part and start foundations coding giving back > > On Friday, March 4, 2016 at 1:09:00 AM UTC+2, Adam Johnson wrote: >> >> The *django.contrib.postgres* docs state: >> >

Re: Proposal: provide postgresql powered full-text search in djangoproject.com

2017-05-08 Thread Adam Johnson
ehaviour with some relational queries > easily at the same time. I'm pretty sure our search requirements on dp.com > need that, so using a dedicated search provider is a better option. > > On 7 May 2017 at 13:22, Florian Apolloner <f.apollo...@gmail.com> wrote: > >> On S

Re: Proposal: provide postgresql powered full-text search in djangoproject.com

2017-05-07 Thread Adam Johnson
I guess we'd also have the benefit of not having to keep elasticsearch running. But I'm afraid I'm not familiar with Postgres. Is the FTS in Postgres mostly equivalent to ES, or will some kinds of search queries be affected? On 7 May 2017 at 09:53, Paolo Melchiorre wrote:

Re: Easier way to populate test databases for parallel tests (patch in github)

2017-04-29 Thread Adam Johnson
> > Actually, if I may ask, how else would one load bunches of fixtures in the > DB and run tests in parallel without my PR ? > As I said, register a post_migrate handler during testing that loads your data. It will run during the creation of the first database in

Re: Easier way to populate test databases for parallel tests (patch in github)

2017-04-29 Thread Adam Johnson
Avoiding migrations, one can populate test data with a post_migrate signal handler. django.contrib.contenttypes already does this to fill the DB with content types, see https://github.com/django/django/blob/c651331b34b7c3841c126959e6e52879bc6f0834/django/contrib/contenttypes/apps.py#L18 . To do it

Re: Admin and CSS Custom Properties

2017-04-27 Thread Adam Johnson
Thanks for introducing me to a new CSS feature! I clearly don't keep up with front end stuff enough. Re: your issues: 1. From the support grid at the bottom of the Smashing Magazine article you linked, it looks like it's only IE 11 and Edge 14 that are major browsers that don't support it.

Re: Ticket 28087: Allow filtering and ordering with RawQuerySet

2017-04-21 Thread Adam Johnson
а > реквизиты') > requisites_object = GenericForeignKey('requisites_type', 'requisites_id') > is_preferred_withdrawal = models.NullBooleanField(default=None, > verbose_name='Предпочтительный способ вывода') > > > On Friday, April 21, 2017 at 7:55:31 PM UTC+3, Adam Johnson wrote: &g

Re: Ticket 28087: Allow filtering and ordering with RawQuerySet

2017-04-21 Thread Adam Johnson
n Friday, April 21, 2017 at 1:40:47 PM UTC+3, Adam Johnson wrote: >> >> Joining two tables like that on one-to-one relations can be easily >> achieved with select_related >> <https://docs.djangoproject.com/en/1.11/ref/models/querysets/#select-related> >> . &

Re: Ticket 28087: Allow filtering and ordering with RawQuerySet

2017-04-21 Thread Adam Johnson
ilerequisites ' > 'ON isp_finances_profilerequisites.profile_id = isp_user_profile.user_id ' > 'JOIN auth_user ' > 'ON auth_user.id = isp_user_profile.user_id ' > > > Is such RAW query (with working pagination and sorting) possible to > convert to model manager QuerySet query? > > On Frid

Re: Ticket 28087: Allow filtering and ordering with RawQuerySet

2017-04-20 Thread Adam Johnson
I'm worried this doesn't work in the general case, as there are a lot of different query formats one can write with raw SQL, such as UNION, SQL variables, or other database specific formats. You have a lot of code there, but from what I can tell the code is simply setting up the RawSqlCompiler

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

2017-04-19 Thread Adam Johnson
A massive +1 from me too, but I'll not make any comments on design :) On 19 April 2017 at 09:58, Federico Capoano wrote: > Looks like a great improvement for newcomers! I hope to see this included > to Django. > > Federico > > -- > You received this message because

Re: #26369: default formfield callback override

2017-04-16 Thread Adam Johnson
> > About 1, if it's already working with a non-signal, how could it not work > with a signal ? It is, after all, called from within formfield() in this > implementation, so anything that's working today when formfield() is > called, should work when formfield() emits a signal. > Signal handlers

Re: Database "execute hooks" for instrumentation

2017-04-13 Thread Adam Johnson
django-perf-rec would love this, it currently monkey patches connection.ops.last_executed_query to listen to all the queries going on. On 7 April 2017 at 16:10, Shai Berger wrote: > On Friday 07 April 2017 17:47:51 Carl Meyer wrote:

Re: DJANGO_SETTINGS_FILE

2017-04-13 Thread Adam Johnson
I implemented this based upon the code snippet I showed in my first reply. Anyone who wishes to use DJANGO_SETTINGS_FILE can now pip install django-settings-file and follow its setup instructions: https://pypi.python.org/pypi/django-settings-file I've added some caveats I thought of during

Re: Making __repr__ safe by default

2017-04-07 Thread Adam Johnson
Patryk, when you say 'revisit', do you have links to the original discussion/tickets? I also agree that __repr__ shouldn't be able to trigger extra DB queries in a standard setup. On 7 April 2017 at 13:18, wrote: > I'd like to support this, I've seen my share of situations

Re: assertRaises vs. assertRaisesMessage

2017-04-07 Thread Adam Johnson
That said more structured attributes on exceptions can be useful for Django users, if you know any obvious places they are missing. On 7 April 2017 at 13:23, Adam Johnson <m...@adamj.eu> wrote: > I agree with Tim. He's also probably the most familiar with the cost of > message change

Re: assertRaises vs. assertRaisesMessage

2017-04-07 Thread Adam Johnson
I agree with Tim. He's also probably the most familiar with the cost of message changes  On 7 April 2017 at 12:56, Tim Graham wrote: > Hi Shai, > > Without testing for a message, there's also a possibility that the > exception you think you're testing isn't the one the

Re: [feature request] including HttpResponse(status=204) as an HttpResponse subclasses

2017-04-07 Thread Adam Johnson
Personally I'd be in favour of adding such classes. It seems against the batteries-included philosophy that Django does not provide all of the standard codes as classes. I can never remember which codes correspond to which response types, if I saw status=204 in code it would be a 'magic number'

Re: DJANGO_SETTINGS_FILE

2017-04-06 Thread Adam Johnson
You could do this already by putting a file on PYTHONPATH that just reads the contents of the file specified by DJANGO_SETTINGS_FILE and puts it in its own module dict, e.g. $ cat ~/tmp/test.py foobar = 12 $ TEST_SETTINGS_FILE=~/tmp/test.py ipython ... In [1]: import imp, os In [2]: test =

Re: proposal: add special subclass of ForeignKey for storing ContentTypes

2017-04-05 Thread Adam Johnson
Sergey, I like the idea. It at least serves as a demonstration of what can be done with custom fields. The PoC shows it's not too much code either. Would you be looking to replace the existing FK's to ContentType too, e.g. in Admin and Auth? On 5 April 2017 at 06:24, Asif Saifuddin

Provide 'V' as alias for 'Value'?

2017-04-03 Thread Adam Johnson
When writing filter expressions using database functions, one is often forced to use django.db.models.Value to wrap raw values to avoid them being interpreted as column references. Value is fairly cumbersome to write when it can appear several times in a complex queryset definition, so it's common

Re: Feature request: django.py makemessages --add-location=full|file|never

2017-03-27 Thread Adam Johnson
I don't see any reason against adding it. If there isn't a ticket already, you can make one at https://code.djangoproject.com/ , then look at the extensive contributing guide . On 27 March 2017 at 19:26,

<    5   6   7   8   9   10   11   >