Re: [Django] #24997: Allow bulk_create with proxy inheritance

2015-06-17 Thread Django
#24997: Allow bulk_create with proxy inheritance
-+-
 Reporter:  wkschwartz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  proxy, inheritance,  | Triage Stage:  Accepted
  bulk_create, queryset, insert  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 One possible approach is that we change bulk_create()'s approach to be
 "save the objects to the database using fastest method available". We
 could add a couple of flags, too, for example signals=True/False and
 with_pk=True/False. The defaults would be False and False.

 Then we would check if the given database can do a fast bulk-insert, or if
 we need to switch to a loop with obj.save(force_insert=True).

 I guess the biggest problem is that it might be a bit surprising if
 bulk_create doesn't do the insert in bulk. But even then, the current
 alternative is to do the insert by a loop of save() calls, and that is
 exactly what you will get from the updated bulk_create.

 For example in fixture loading it would be very convenient if one could
 always call bulk_create(), and get the fastest possible bulk insert for
 the given model class and database backend combination.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.50f3750c5d707179d173f3c58cfa01d6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #15760: Feature: JS Hooks for Dynamic Inlines

2015-06-17 Thread Django
#15760: Feature: JS Hooks for Dynamic Inlines
-+-
 Reporter:  mlavin   |Owner:
 Type:  New feature  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  inlines jquery   | Triage Stage:  Accepted
  callback   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-

Comment (by RamezIssac):

 How About to extend the current plugin default to accept say
 'addedCallback' and 'deletedCalback' which can be assigned in to the
 django.jQuery.fn.formset.default . Those are left for the user to fill
 The Tabluar & Stacked inline js can callback those function along with
 their 'added' function

 And as answer to  julien question about what if many inline existed on a
 page , we can send both the created form and the formset name.

 For using this new feature, a change_form template is extended for the
 model you want to work with, and we add the javascript function of desire
 inside the HTML template. Mainly in the change_form_document_ready block
 or maybe a new block (where missing block.super is not gonna mess things
 up)

 I can do that if idea is accepted

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.290e71b52a5151357fa0e75ed7a9b9c4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24997: Allow bulk_create with proxy inheritance

2015-06-17 Thread Django
#24997: Allow bulk_create with proxy inheritance
-+-
 Reporter:  wkschwartz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  proxy, inheritance,  | Triage Stage:  Accepted
  bulk_create, queryset, insert  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by wkschwartz):

 I'll try to work this up into a real patch, but what I found was that the
 following changes relative to the code at git tag 1.8.2 make the test
 cases described in this ticket pass.

 {{{#!python
 --- django/db/models/query.py   2015-06-17 17:29:38.0 -0400
 +++ django/db/models/query.py   2015-06-17 17:31:26.0 -0400
 @@ -370,13 +370,13 @@
  # this by using RETURNING clause for the insert query. We're
 punting
  # on these for now because they are relatively rare cases.
  assert batch_size is None or batch_size > 0
 -if self.model._meta.parents and not self.model._meta.proxy:
 +if self.model._meta.parents:
  raise ValueError("Can't bulk create an inherited model")
  if not objs:
  return objs
  self._for_write = True
  connection = connections[self.db]
 -fields = self.model._meta.concrete_fields
 +fields = self.model._meta.local_concrete_fields
  objs = list(objs)
  self._populate_pk_values(objs)
  with transaction.atomic(using=self.db, savepoint=False):
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.dd1b062aa5a27b9988586100d22e547e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24914: Include basic permission mixins into Django

2015-06-17 Thread Django
#24914: Include basic permission mixins into Django
--+
 Reporter:  raphaelm  |Owner:  MarkusH
 Type:  New feature   |   Status:  closed
Component:  contrib.auth  |  Version:  master
 Severity:  Normal|   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Markus Holtermann ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"e5cb4e14118f3a508e3bc00ee7cd50bb0f18a61d" e5cb4e1]:
 {{{
 #!CommitTicketReference repository=""
 revision="e5cb4e14118f3a508e3bc00ee7cd50bb0f18a61d"
 Fixed #24914 -- Added authentication mixins for CBVs

 Added the mixins LoginRequiredMixin, PermissionRequiredMixin and
 UserPassesTestMixin to contrib.auth as counterparts to the respective
 view decorators.

 The authentication mixins UserPassesTestMixin, LoginRequiredMixin and
 PermissionRequiredMixin have been inspired by django-braces
 

 Thanks Raphael Michel for the initial patch, tests and docs on the PR
 and Ana Balica, Kenneth Love, Marc Tamlyn, and Tim Graham for the
 review.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.6296b7f28484fd8e7340db7a58820c24%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24829: TemplateView raises unhandled ContentNotRenderedError error when used as error handler

2015-06-17 Thread Django
#24829: TemplateView raises unhandled ContentNotRenderedError error when used as
error handler
-+-
 Reporter:  nonZero  |Owner:  ana-
 |  balica
 Type:  New feature  |   Status:  closed
Component:  Generic views|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"2f615b10e6330d27dccbd770a4628200044acf70" 2f615b10]:
 {{{
 #!CommitTicketReference repository=""
 revision="2f615b10e6330d27dccbd770a4628200044acf70"
 Fixed #24829 -- Allowed use of TemplateResponse in view error handlers.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.ec3b2f83f99588cfb581c062df18626c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24997: Allow bulk_create with proxy inheritance

2015-06-17 Thread Django
#24997: Allow bulk_create with proxy inheritance
-+-
 Reporter:  wkschwartz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  proxy, inheritance,  | Triage Stage:  Accepted
  bulk_create, queryset, insert  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * type:  Bug => New feature
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 If it's feasible to implement, I don't see why we couldn't do it.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.38de7053bb147e1a2f6833522067d49d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24997: Allow bulk_create with proxy inheritance

2015-06-17 Thread Django
#24997: Allow bulk_create with proxy inheritance
-+-
 Reporter:  wkschwartz   |  Owner:  nobody
 Type:  Bug  | Status:  new
Component:  Database layer   |Version:  1.8
  (models, ORM)  |   Keywords:  proxy, inheritance,
 Severity:  Normal   |  bulk_create, queryset, insert
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  0|  UI/UX:  0
-+-
 = Overview =

 The [https://docs.djangoproject.com/en/1.8/ref/models/querysets/#bulk-
 create documentation] for the Queryset method `bulk_create` states:

  It does not work with child models in a multi-table inheritance scenario.

 `bulk_create` also does not work with proxy inheritance, which does not
 involve multiple tables. Rather than changing the documentation to reflect
 that neither type of inheritance is supported, it would be better to allow
 proxy inheritance to work.

 = Origin of the problem =

 It makes sense not to allow `bulk_create` with multiple tables. The
 
[https://github.com/django/django/blob/04e8d890aec8e996d56856164a27a6a76057/django/db/models/query.py#L416
 comment] in `bulk_create` explains it best:

  So this case is fun. When you bulk insert you don't get the primary keys
 back (if it's an autoincrement), so you can't insert into the child tables
 which references this. There are two workarounds, 1) this could be
 implemented if you didn't have an autoincrement pk, and 2) you could do it
 by doing O(n) normal inserts into the parent tables to get the primary
 keys back, and then doing a single bulk insert into the childmost table.
 Some databases might allow doing this by using RETURNING clause for the
 insert query. We're punting on these for now because they are relatively
 rare cases.

 `bulk_create` prevents inherited models from using it with
 
[https://github.com/django/django/blob/04e8d890aec8e996d56856164a27a6a76057/django/db/models/query.py#L426
 the following naive test]:

 {{{#!python
 if self.model._meta.parents:
 raise ValueError("Can't bulk create an inherited model")
 }}}

 This test does not discriminate between multi-table inheritance and proxy
 inheritance. However, simply modifying the code to read

 {{{#!python
 if self.model._meta.parents and not self.model._meta.proxy:
 raise ValueError("Can't bulk create an inherited model with multiple
 tables")
 }}}

 does not fix the problem because it results in more exceptions.

 = Reproducing this error =
 I did the following using Django 1.8.2 and Python 3.4.3 on Mac OS 10.9.5.

 {{{#!bash
 django-admin startproject bulk_create_proxy
 cd bulk_create_proxy
 ./manage.py startapp app
 }}}

 Add `'app'` to the `INSTALLED_APPS` list in the resultant `settings.py`.
 Save the following code in `app/models.py`.

 {{{#!python
 from django.db import models

 class Parent(models.Model):
 name = models.CharField(max_length=10)

 class Child(Parent):
 class Meta(object):
 proxy = True
 }}}

 Save the following code in `app/tests.py`.

 {{{#!python
 from django.test import TestCase

 from app.models import Parent, Child


 class TestBulkCreate(TestCase):

 def assert_can_bulk_create(self, model):
 model.objects.all().delete()
 model.objects.bulk_create([
 model(name='a'), model(name='b'), model(name='c')])
 self.assertEqual(model.objects.count(), 3)

 def test_bulk_create_parent(self):
 self.assert_can_bulk_create(Parent)

 def test_bulk_create_child(self):
 self.assert_can_bulk_create(Child)
 }}}

 Finish up with the following commands.

 {{{#!bash
 ./manage.py makemigrations app
 ./manage.py migrate
 ./manage.py test
 }}}

 You should get the following test output. (I have elided file paths; ones
 starting with `...django` come from Django.)

 {{{
 bulk_create_proxy ➜ ./manage.py test
 Creating test database for alias 'default'...
 E.
 ==
 ERROR: test_bulk_create_child (app.tests.TestBulkCreate)
 --
 Traceback (most recent call last):
   File "...bulk_create_proxy/app/tests.py", line 18, in
 test_bulk_create_child
 self.assert_can_bulk_create(Child)
   File "...bulk_create_proxy/app/tests.py", line 11, in
 assert_can_bulk_create
 model(name='a'), model(name='b'), model(name='c')])
   File "...django/db/models/manager.py", line 127, in manager_method
 return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "...django/db/models/query.py", line 374, in bulk_create
 raise ValueError("Can't bulk create an inherited model")
 ValueError: Can't bulk create an inherited model

 --
 Ran 2 tests in 

Re: [Django] #13751: Avoid open redirect issue with whitelist

2015-06-17 Thread Django
#13751: Avoid open redirect issue with whitelist
-+-
 Reporter:  anonymous|Owner:
 Type:  New feature  |   Status:  closed
Component:  HTTP handling|  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  open redirect,   | Triage Stage:  Accepted
  security   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => wontfix


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.476e2afb1f73eb42b33b2dfc337b4958%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24996: Reimplement the DatabaseFeatures.supports_select_related flag

2015-06-17 Thread Django
#24996: Reimplement the DatabaseFeatures.supports_select_related flag
-+-
   Reporter:  timgraham  |  Owner:  nobody
   Type:  Bug| Status:  new
  Component:  Database   |Version:  1.8
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 In Django 1.8, the `supports_select_related` database feature flag was
 refactored away in 0c7633178fa9410f102e4708cef979b873bccb76. If we add it
 back, it would be nice to also add a test that mocks the value to `False`,
 then checks that a `select_related()` call doesn't have any effect. The
 original ticket is #17335.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.f2ef00f7ae1f79e8ed09b2b0484ad06d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9071: Can't disable "add" popup links in the admin

2015-06-17 Thread Django
#9071: Can't disable "add" popup links in the admin
---+--
 Reporter:  jacob  |Owner:  burzak
 Type:  New feature|   Status:  closed
Component:  contrib.admin  |  Version:  1.0
 Severity:  Normal |   Resolution:  worksforme
 Keywords:  pyconuk| Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  1
Easy pickings:  0  |UI/UX:  1
---+--
Changes (by claudep):

 * status:  assigned => closed
 * resolution:   => worksforme


Comment:

 Closing as per last comment and lack of activity.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.851223299562a61cc8963e5c9a94fa56%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24829: TemplateView raises unhandled ContentNotRenderedError error when used as error handler

2015-06-17 Thread Django
#24829: TemplateView raises unhandled ContentNotRenderedError error when used as
error handler
-+-
 Reporter:  nonZero  |Owner:  ana-
 |  balica
 Type:  New feature  |   Status:  assigned
Component:  Generic views|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by MarkusH):

 * stage:  Accepted => Ready for checkin


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.5ee43a07de117e3f1df4b89345953d9c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9619: to_python not called when fetching data with .values(...)

2015-06-17 Thread Django
#9619: to_python not called when fetching data with .values(...)
-+-
 Reporter:  Valera Grishin   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  values,custom| Triage Stage:  Accepted
  field, datetime|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Markus Holtermann ):

 In [changeset:"64a4211aa85795cb21a73bc93f9e43bafa1541f6" 64a4211]:
 {{{
 #!CommitTicketReference repository=""
 revision="64a4211aa85795cb21a73bc93f9e43bafa1541f6"
 Refs #9619 -- Fixed failing test case

 Regression introduced in 9aac99e96d100b34b6daa3a137531eff4f17076e
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.4469c46caceeef1de26d8c21c673d873%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24914: Include basic permission mixins into Django

2015-06-17 Thread Django
#24914: Include basic permission mixins into Django
--+
 Reporter:  raphaelm  |Owner:  MarkusH
 Type:  New feature   |   Status:  assigned
Component:  contrib.auth  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by MarkusH):

 Thanks jaysonsantos, I had something like that in an experimental version,
 but dropped it because I disliked iterating over `__bases__` or `mro()`.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.7341243cbbd22e6da159bcb39cf5e060%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24834: Optional port in Host request header breaks get_current_site()

2015-06-17 Thread Django
#24834: Optional port in Host request header breaks get_current_site()
-+-
 Reporter:  ngnpope  |Owner:  ngnpope
 Type:  Bug  |   Status:  assigned
Component:  contrib.sites|  Version:  1.5
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by MarkusH):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.60374b1db3531b2fd04eebfe69069763%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24994: Document/check that settings.SECRET_KEY should be a valid unicode string

2015-06-17 Thread Django
#24994: Document/check that settings.SECRET_KEY should be a valid unicode string
-+-
 Reporter:  bmispelon|Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Core (System |  Version:  1.8
  checks)|
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by bmispelon):

 I think trying `force_text()`, `force_bytes` and catching any
 `EncodingError` would be a good approach and should be "backwards-
 compatible" in the sense that projects with a SECRET_KEY that currently
 works should not trigger the check.

 As for how that person ended up with this weird bytestring SECRET_KEY, I
 have no idea.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.30756014a01685797d4adc1805d769bb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9619: to_python not called when fetching data with .values(...)

2015-06-17 Thread Django
#9619: to_python not called when fetching data with .values(...)
-+-
 Reporter:  Valera Grishin   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  values,custom| Triage Stage:  Accepted
  field, datetime|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => fixed


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.fd658001c30855ec5aab823c7830ddf6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9619: to_python not called when fetching data with .values(...)

2015-06-17 Thread Django
#9619: to_python not called when fetching data with .values(...)
-+-
 Reporter:  Valera Grishin   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  values,custom| Triage Stage:  Accepted
  field, datetime|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"9aac99e96d100b34b6daa3a137531eff4f17076e" 9aac99e]:
 {{{
 #!CommitTicketReference repository=""
 revision="9aac99e96d100b34b6daa3a137531eff4f17076e"
 Refs #9619 -- Added a test that Field.from_db_value() is called on
 QuerySet.values()
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.59545a3dc6a36f8aa0c897d77ff215de%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24994: Document/check that settings.SECRET_KEY should be a valid unicode string

2015-06-17 Thread Django
#24994: Document/check that settings.SECRET_KEY should be a valid unicode string
-+-
 Reporter:  bmispelon|Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Core (System |  Version:  1.8
  checks)|
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by timgraham):

 Would it be correct to check that `force_text(SECRET_KEY)` and
 `force_bytes(SECRET_KEY)` don't throw an exception? There's logic in
 `django/conf/__init__.py` to verify that `SECRET_KEY` isn't an empty, so
 maybe the check could be done there. On the other hand, it wouldn't be
 nice to break sites that are functioning with keys that don't meet these
 requirements. Did you find out how someone ended up with a broken key in
 the first place?

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.e385193c77e2dfa89f483faec0f3d348%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24995: MySQL error when renaming a primary key (was: MySQL error in migrations)

2015-06-17 Thread Django
#24995: MySQL error when renaming a primary key
+
 Reporter:  EikeDehling |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.8
 Severity:  Normal  |   Resolution:
 Keywords:  rename mysql error  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  1   |  Patch needs improvement:  0
Easy pickings:  0   |UI/UX:  0
+
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_tests:   => 1
 * needs_docs:   => 0
 * type:  Uncategorized => Bug
 * stage:  Unreviewed => Accepted


Comment:

 A regression test in `tests/schema` is also needed.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.46364c8374933764114853733804dc6e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24995: MySQL error in migrations

2015-06-17 Thread Django
#24995: MySQL error in migrations
---+
 Reporter:  EikeDehling|  Owner:  nobody
 Type:  Uncategorized  | Status:  new
Component:  Migrations |Version:  1.8
 Severity:  Normal |   Keywords:  rename mysql error
 Triage Stage:  Unreviewed |  Has patch:  1
Easy pickings:  0  |  UI/UX:  0
---+
 In a migration where a primary-key field is renamed, a mysql error occurs,
 because mysql needs foreign keys to be disabled/dropped for that
 operation.

 See here for an example of the  error you would get:
 http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-
 database-sql-2e0f-1254ba7-to-database-table


 I have a patch which fixes the issue:
 
https://github.com/EikeDehling/django/commit/dbe0c4692fe1a7d73e4de345a171b8cbb35651b2

 Please let me know what i can do to get this merged/fixed in django.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.95da81f9b9b8d704839775c6afb8d15e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24978: Can't load fixtures with '[' and ']' in path

2015-06-17 Thread Django
#24978: Can't load fixtures with '[' and ']' in path
-+-
 Reporter:  mkow |Owner:  MoritzS
 Type:  Bug  |   Status:  closed
Component:  Core (Management |  Version:  1.8
  commands)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  square brackets  | Triage Stage:  Accepted
  fixture path not found |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => fixed


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.759ae58017f3b14d3e932a434c206434%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24978: Can't load fixtures with '[' and ']' in path

2015-06-17 Thread Django
#24978: Can't load fixtures with '[' and ']' in path
-+-
 Reporter:  mkow |Owner:  MoritzS
 Type:  Bug  |   Status:  new
Component:  Core (Management |  Version:  1.8
  commands)  |
 Severity:  Normal   |   Resolution:
 Keywords:  square brackets  | Triage Stage:  Accepted
  fixture path not found |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"81aae2884377ff1a60b74e510e3358738971bbc0" 81aae28]:
 {{{
 #!CommitTicketReference repository=""
 revision="81aae2884377ff1a60b74e510e3358738971bbc0"
 Refs #24978 -- Skipped an unsupported test on Windows.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.ed6b35d40a131914e2a35d467030caeb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24993: Add unittests for Custom Model field

2015-06-17 Thread Django
#24993: Add unittests for Custom Model field
-+-
 Reporter:  jedie|Owner:  nobody
 Type:  Uncategorized|   Status:  closed
Component:  Database layer   |  Version:  1.7
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  subfieldbase,| Triage Stage:
  metaclass  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => wontfix


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.6daa31b03a7420f139ed266deb9d6de8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9619: to_python not called when fetching data with .values(...)

2015-06-17 Thread Django
#9619: to_python not called when fetching data with .values(...)
-+-
 Reporter:  Valera Grishin   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  values,custom| Triage Stage:  Accepted
  field, datetime|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by jedie):

 If i see it right, this has been fixed with Django v1.8 and the change
 from {{{to_python()}}}  to {{{from_db_value()}}} isn't it?

 The docs at https://docs.djangoproject.com/en/1.8/howto/custom-model-
 fields/#converting-values-to-python-objects says:
 {{{
 If present for the field subclass, from_db_value() will be called in all
 circumstances when the data is loaded from the database, including in
 aggregates and values() calls.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.c29a2f6599b67321a7594de3532e06de%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24994: Document/check that settings.SECRET_KEY should be a valid unicode string

2015-06-17 Thread Django
#24994: Document/check that settings.SECRET_KEY should be a valid unicode string
+
   Reporter:  bmispelon |  Owner:  nobody
   Type:  Cleanup/optimization  | Status:  new
  Component:  Core (System checks)  |Version:  1.8
   Severity:  Normal|   Keywords:
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+
 The documentation for SECRET_KEY [1] is not very explicit as to whether it
 should contain text or bytes.

 Using bytes sort of works but can break with cryptic error messages.

 From a quick `git grep`, the secret key is used only in two places:

 * In `core/signing.py` where it's cast into bytes with `force_bytes()`
 * In `utils/crypto.py` where it's `%s` formatted into a unicode string (so
 Python2 will transparently try to decode it if needed)

 We should at least document the exact type we're expecting and I think it
 would also be worthwhile to add a check to make sure the user's key passes
 our expectations.

 [1] https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-
 SECRET_KEY

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.fe1681a44991ff5fe99ddc9a5d149097%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23763: Python 3.5 compatibility

2015-06-17 Thread Django
#23763: Python 3.5 compatibility
--+
 Reporter:  timgraham |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Tim Graham ):

 In [changeset:"3f2de803181ca3c5526ec9d708b2098b8f683808" 3f2de803]:
 {{{
 #!CommitTicketReference repository=""
 revision="3f2de803181ca3c5526ec9d708b2098b8f683808"
 Refs #23763 -- Fixed Python 3.5 PendingDeprecationWarning in LazyStream.

 Fixed "PendingDeprecationWarning: generator
 'LazyStream.read..parts'
 raised StopIteration" per PEP 0479.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.4e13858c1bd462ce138f9438a3dbcac6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24993: Add unittests for Custom Model field

2015-06-17 Thread Django
#24993: Add unittests for Custom Model field
-+-
 Reporter:  jedie|Owner:  nobody
 Type:  Uncategorized|   Status:  new
Component:  Database layer   |  Version:  1.7
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  subfieldbase,| Triage Stage:
  metaclass  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Did you see `field_subclassing/fields.py`? As `SubfieldBase` is deprecated
 in Django 1.8, I don't think there's much value in adding new tests at
 this point.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.3b363902e0a1dc1dd745b586dd9781e8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24991: Range types not properly converted to SQL in QuerySet.query.__str__()

2015-06-17 Thread Django
#24991: Range types not properly converted to SQL in QuerySet.query.__str__()
--+
 Reporter:  unklphil  |Owner:
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.8
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by timgraham):

 * needs_better_patch:   => 0
 * stage:  Unreviewed => Accepted
 * type:  Uncategorized => Bug
 * needs_tests:   => 0
 * needs_docs:   => 0


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.1a0c94d7aa61a2353db3728beafd02ea%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24992: merge subfieldbase-metaclass example code in docs

2015-06-17 Thread Django
#24992: merge subfieldbase-metaclass example code in docs
-+-
 Reporter:  jedie|Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Documentation|  Version:  1.7
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  subfieldbase,| Triage Stage:
  metaclass  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * needs_better_patch:   => 0
 * resolution:   => wontfix
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 `SubfieldBase` is deprecated in Django 1.8 so those examples no longer
 appear in newer versions of the docs.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.054b3ca26c043ead967cf9cea1c91868%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24993: Add unittests for Custom Model field

2015-06-17 Thread Django
#24993: Add unittests for Custom Model field
--+
 Reporter:  jedie |  Owner:  nobody
 Type:  Uncategorized | Status:  new
Component:  Database layer (models, ORM)  |Version:  1.7
 Severity:  Normal|   Keywords:  subfieldbase,
  |  metaclass
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 I seems that there are no tests for "Custom Model field" described here:

 https://docs.djangoproject.com/en/1.7/howto/custom-model-fields/#the-
 subfieldbase-metaclass

 I create one and will send it as a pull request.

 See also https://groups.google.com/forum/#!topic/django-
 developers/nYhZYyLcV1g

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.c020da38f4f40ca3b72941ec5d820950%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24992: merge subfieldbase-metaclass example code in docs

2015-06-17 Thread Django
#24992: merge subfieldbase-metaclass example code in docs
--+
 Reporter:  jedie |  Owner:  nobody
 Type:  Cleanup/optimization  | Status:  new
Component:  Documentation |Version:  1.7
 Severity:  Normal|   Keywords:  subfieldbase,
  |  metaclass
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 https://docs.djangoproject.com/en/1.7/howto/custom-model-fields/#the-
 subfieldbase-metaclass contains  three code examples:

 * for Python 2 only
 * for Python 3 only
 * for Python 2+3 using six.with_metaclass()

 What's about to remove the first two examples and leave only the
 six.with_metaclass() example?!?

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.1003d9c6711b2a1ac826b07852709fa3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9619: to_python not called when fetching data with .values(...)

2015-06-17 Thread Django
#9619: to_python not called when fetching data with .values(...)
-+-
 Reporter:  Valera Grishin   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  values,custom| Triage Stage:  Accepted
  field, datetime|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by jedie):

 * cc: django@… (added)


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.d6e4a9d230a8e9fff9bde5add9520d70%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24991: Range types not properly converted to SQL in QuerySet.query.__str__()

2015-06-17 Thread Django
#24991: Range types not properly converted to SQL in QuerySet.query.__str__()
--+-
 Reporter:  unklphil  |  Owner:
 Type:  Uncategorized | Status:  new
Component:  contrib.postgres  |Version:  1.8
 Severity:  Normal|   Keywords:
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+-
 The string representation of the `QuerySet.query` object, which is useful
 in debugging, does not convert range types to their SQL equivalents,
 instead it just displays the string representation of the range type.

 {{{
 >>> import datetime
 >>> from django.utils.timezone import utc
 >>> from psycopg.extras import NumericRange, DateRange, DateTimeTZRange
 >>> from myapp.models import MyModel  # model defintion is irrelevant

 >>> print(MyModel.objects.filter(num_rng__overlap=NumericRange(1, 5)))
 SELECT [...] FROM "myapp_mymodel" WHERE ("myapp_mymodel"."num_rng" &&
 NumericRange(1, 5, '[)'))

 >>>
 print(MyModel.objects.filter(date_rng__overlap=DateRange(datetime.date(2015,
 5, 1), datetime.date(2015, 6, 1
 SELECT [...] FROM "myapp_mymodel" WHERE ("myapp_mymodel"."date_rng" &&
 DateRange(datetime.date(2015, 5, 1), datetime.date(2015, 6, 1), '[)'))

 >>>
 
print(MyModel.objects.filter(dt_rng__overlap=DateTimeTZRange(datetime.datetime(2015,
 5, 1, tzinfo=utc), datetime.datetime(2015, 6, 1, tzinfo=utc
 SELECT [...] FROM "myapp_mymodel" WHERE ("myapp_mymodel"."dt_rng" &&
 DateTimeTZRange(datetime.datetime(2015, 5, 1, 0, 0, tzinfo=),
 datetime.datetime(2015, 6, 1, 0, 0, tzinfo=), '[)'))
 }}}

 The expected output is `numrange(1.0, 5.0)`, `daterange('2015-05-01',
 '2015-06-01')` and `tstzrange('2015-05-01 00:00:00+00:00', '2015-06-01
 00:00:00+00:00')` respectively.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.7d3f6f6d0c7f817d9d7f4f875cf8f2db%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.