ORM expressions DEP

2014-10-27 Thread Anssi Kääriäinen
The ORM expressions DEP 
(https://github.com/django/deps/blob/master/drafts/orm_expressions.rst) is 
now ready for review.

In brief, the DEP proposes an improved and publicly documented way to write 
expressions for the ORM. The expressions can be used in .annotate() calls. 
The DEP also proposes that aggregates are a subclass of expressions.

The benefits are:
  - Public API to write expressions
  - Simplified implementation of how expressions are added to the query and 
how they are evaluated
  - Aggregates behave similarly to other ORM expressions

A pull request by Josh Smeaton implements the DEP 
(https://github.com/django/django/pull/2496).

My understanding is that we don't have yet any process for how to accept 
(or number...) DEPs. I propose that first the community reviews the DEP. 
Unless there is clear objection to the DEP, the technical board can then 
consider if (and how) they want to accept the DEP.

 - Anssi

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9b7fcf81-e618-4ea5-a806-2ffd3cd42718%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Removing Unique Together Field (X-Post django-core-mentorship)

2014-10-27 Thread Bill Prin
Hi all,

I wasn't sure which mailing list to put this on, so I cross-posted it with 
django-core-mentorship. Apologies if this isn't the right forum.

I stumbled across an issue when removing a field from a unique_together 
constraint. Specifically, when you remove a field, and remove it from the 
unique_together constraint, the makemigration command creates a migration 
that first removes the field, then removes the constraint. However, it puts 
the operations in the wrong order which creates an error.

I've had this problem in Django 1.7, and I just checked out master 1.8 from 
github and reproduced the issue.

Here I am removing a field question3 from a model, as well as removing it 
from the unique_together constraint (question1, question2, question3).

operations = [
migrations.RemoveField(
model_name='question',
name='question3',
),
migrations.AlterUniqueTogether(
name='question',
unique_together=set([('question1', 'question2')]),
)
]

The problem is that the field is gone when the unique together constraint 
is altered, creating this problem:

django.db.models.fields.FieldDoesNotExist: Question has no field named 
u'question3'

This is trivial to fix by reversing the order of the operations. I did 
search the bug tracker and mailing lists and did not find the issue, but 
again, apologies if I didn't look in the right place.

The reason I'm posting here instead of just submitting an issue is because 
I would love to get involved in contributing to core, and this seems like a 
really easy bug to get my hands dirty with. However, given that I'm not 
super familiar with the project, before I dove into it I thought I would 
run it by the mailing lists to verify that I'm not missing something, and 
also that if I do make a pull request to fix it, it will be accepted. 
Thanks for any advice!

Bill

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a6f2837e-2950-4115-b5bd-01fcd87ba4e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Removing Unique Together Field (X-Post django-core-mentorship)

2014-10-27 Thread Tim Graham
Hi Bill,

Yes, I believe this is a valid issue. I think it was reported in 
https://code.djangoproject.com/ticket/23614

Tim

On Monday, October 27, 2014 12:32:10 PM UTC-4, Bill Prin wrote:
>
> Hi all,
>
> I wasn't sure which mailing list to put this on, so I cross-posted it with 
> django-core-mentorship. Apologies if this isn't the right forum.
>
> I stumbled across an issue when removing a field from a unique_together 
> constraint. Specifically, when you remove a field, and remove it from the 
> unique_together constraint, the makemigration command creates a migration 
> that first removes the field, then removes the constraint. However, it puts 
> the operations in the wrong order which creates an error.
>
> I've had this problem in Django 1.7, and I just checked out master 1.8 
> from github and reproduced the issue.
>
> Here I am removing a field question3 from a model, as well as removing it 
> from the unique_together constraint (question1, question2, question3).
>
> operations = [
> migrations.RemoveField(
> model_name='question',
> name='question3',
> ),
> migrations.AlterUniqueTogether(
> name='question',
> unique_together=set([('question1', 'question2')]),
> )
> ]
>
> The problem is that the field is gone when the unique together constraint 
> is altered, creating this problem:
>
> django.db.models.fields.FieldDoesNotExist: Question has no field named 
> u'question3'
>
> This is trivial to fix by reversing the order of the operations. I did 
> search the bug tracker and mailing lists and did not find the issue, but 
> again, apologies if I didn't look in the right place.
>
> The reason I'm posting here instead of just submitting an issue is because 
> I would love to get involved in contributing to core, and this seems like a 
> really easy bug to get my hands dirty with. However, given that I'm not 
> super familiar with the project, before I dove into it I thought I would 
> run it by the mailing lists to verify that I'm not missing something, and 
> also that if I do make a pull request to fix it, it will be accepted. 
> Thanks for any advice!
>
> Bill
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/09170b1f-5ba9-40e5-be16-6f2926f4c908%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Removing Unique Together Field

2014-10-27 Thread Markus Holtermann

Hey Bill,

I added a patch for the ticket Tim already linked to. This solves the
problem for RemoveField operations, RenameField shouldn't be a
problem since the generation of AlterUniqueTogether and
AlterIndexTogether are already based on renamed fields. Tests welcome ;)

/Markus

On Mon, Oct 27, 2014 at 11:48:43AM -0700, Tim Graham wrote:

Hi Bill,

Yes, I believe this is a valid issue. I think it was reported in
https://code.djangoproject.com/ticket/23614

Tim

On Monday, October 27, 2014 12:32:10 PM UTC-4, Bill Prin wrote:


Hi all,

I wasn't sure which mailing list to put this on, so I cross-posted it with
django-core-mentorship. Apologies if this isn't the right forum.

I stumbled across an issue when removing a field from a unique_together
constraint. Specifically, when you remove a field, and remove it from the
unique_together constraint, the makemigration command creates a migration
that first removes the field, then removes the constraint. However, it puts
the operations in the wrong order which creates an error.

I've had this problem in Django 1.7, and I just checked out master 1.8
from github and reproduced the issue.

Here I am removing a field question3 from a model, as well as removing it
from the unique_together constraint (question1, question2, question3).

operations = [
migrations.RemoveField(
model_name='question',
name='question3',
),
migrations.AlterUniqueTogether(
name='question',
unique_together=set([('question1', 'question2')]),
)
]

The problem is that the field is gone when the unique together constraint
is altered, creating this problem:

django.db.models.fields.FieldDoesNotExist: Question has no field named
u'question3'

This is trivial to fix by reversing the order of the operations. I did
search the bug tracker and mailing lists and did not find the issue, but
again, apologies if I didn't look in the right place.

The reason I'm posting here instead of just submitting an issue is because
I would love to get involved in contributing to core, and this seems like a
really easy bug to get my hands dirty with. However, given that I'm not
super familiar with the project, before I dove into it I thought I would
run it by the mailing lists to verify that I'm not missing something, and
also that if I do make a pull request to fix it, it will be accepted.
Thanks for any advice!

Bill



--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/09170b1f-5ba9-40e5-be16-6f2926f4c908%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--


pgpK98m7kpLay.pgp
Description: PGP signature