Re: [Django] #13297: Cannot specify 'pk' in model default ordering

2010-06-19 Thread Django
#13297: Cannot specify 'pk' in model default ordering
---+
  Reporter:  anonymous | Owner:  gruszczy   
Status:  closed| Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  1.1
Resolution:  duplicate |  Keywords:  ordering pk
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by kmtracey):

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

Comment:

 This was already reported in the still-open #8291.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13297: Cannot specify 'pk' in model default ordering

2010-06-07 Thread Django
#13297: Cannot specify 'pk' in model default ordering
---+
  Reporter:  anonymous | Owner:  gruszczy   
Status:  new   | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  1.1
Resolution:|  Keywords:  ordering pk
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by gruszczy):

 I am adding two patches. First changes get_field in options, second
 changes get_validation_errors in validation. Both also have test (which is
 only a model with ordering by pk specified). I hope one of them is good,
 if not, I will be happy to provide something better, if only I am advised
 what can be fixed in this case.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13297: Cannot specify 'pk' in model default ordering

2010-05-27 Thread Django
#13297: Cannot specify 'pk' in model default ordering
---+
  Reporter:  anonymous | Owner:  gruszczy   
Status:  new   | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  1.1
Resolution:|  Keywords:  ordering pk
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by gruszczy):

 Proper formatting of the code.

 {{{
 def get_field(self, name, many_to_many=True):
 """
 Returns the requested field by name. Raises FieldDoesNotExist on
 error.
 """
 if name == 'pk':
 return self.pk
 to_search = many_to_many and (self.fields + self.many_to_many) or
 self.fields
 for f in to_search:
 if f.name == name:
 return f
 raise FieldDoesNotExist('%s has no field named %r' %
 (self.object_name, name))
 }}}

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13297: Cannot specify 'pk' in model default ordering

2010-05-27 Thread Django
#13297: Cannot specify 'pk' in model default ordering
---+
  Reporter:  anonymous | Owner:  gruszczy   
Status:  new   | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  1.1
Resolution:|  Keywords:  ordering pk
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by gruszczy):

  * owner:  nobody => gruszczy

Comment:

 I can either change get_field in options to accept pk:

 def get_field(self, name, many_to_many=True):
 """
 Returns the requested field by name. Raises FieldDoesNotExist on
 error.
 """
 if name == 'pk':
 return self.pk
 to_search = many_to_many and (self.fields + self.many_to_many) or
 self.fields
 for f in to_search:
 if f.name == name:
 return f
 raise FieldDoesNotExist('%s has no field named %r' %
 (self.object_name, name))

 or check this inside get_validation_errors in
 django.core.management.validation. I don't know django core that well to
 decide, which way is better, but it seems to me, that get_field should
 return some good value also for 'pk'. If someone could make this decision,
 I will gladly make a patch and write some tests.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13297: Cannot specify 'pk' in model default ordering

2010-04-08 Thread Django
#13297: Cannot specify 'pk' in model default ordering
---+
  Reporter:  anonymous | Owner:  nobody 
Status:  new   | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  1.1
Resolution:|  Keywords:  ordering pk
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by russellm):

  * needs_better_patch:  => 0
  * stage:  Unreviewed => Accepted
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Looks like a case where the 'pk' alias isn't being expanded correctly. I'm
 not sure we specifically document that this *should* be possible, but it
 would certainly be consistent.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #13297: Cannot specify 'pk' in model default ordering

2010-04-08 Thread Django
#13297: Cannot specify 'pk' in model default ordering
--+-
 Reporter:  anonymous |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  1.1   
 Keywords:  ordering pk   |   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 I wanted to make an explicit default ordering over a model's primary key
 (it does make sense in my app), but manage.py validate complains:
 "ordering" refers to "pk", a field that doesn't exist.

 Specifying 'id' is fine with 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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.