Re: [Django] #13606: admin raw_id_fields fail to check against non-numerical input

2010-05-27 Thread Django
#13606: admin raw_id_fields fail to check against non-numerical input
---+
  Reporter:  petrikuitti...@yahoo.com  | Owner:  nobody
Status:  closed| Milestone:
 Component:  django.contrib.admin  |   Version:  1.2   
Resolution:  duplicate |  Keywords:
 Stage:  Unreviewed| Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  1 
Needs_better_patch:  0 |  
---+
Changes (by kmtracey):

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

Comment:

 The previous ticket (#13149) is still open; the place to post information
 on what is necessary to get it fixed in current trunk code is there. It's
 one problem, there should be only one ticket for tracking getting it
 fixed. The version for that ticket being set to 1.1 just indicates that
 the problem has been around at least since 1.1, it does not mean the fix
 will be specific to 1.1. For any ticket the fix will be made to current
 trunk and backported to the current release branch (if necessary). If the
 existing patches on that ticket no longer work, then it should be marked
 patch needs improvement, or better yet a new patch should be uploaded that
 fixes the problem for current code. A second ticket to track the same
 problem is not helpful.

-- 
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] #13606: admin raw_id_fields fail to check against non-numerical input

2010-05-27 Thread Django
#13606: admin raw_id_fields fail to check against non-numerical input
---+
  Reporter:  petrikuitti...@yahoo.com  | Owner:  nobody
Status:  reopened  | Milestone:
 Component:  django.contrib.admin  |   Version:  1.2   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  1 
Needs_better_patch:  0 |  
---+
Changes (by anonymous):

  * status:  closed => reopened
  * has_patch:  0 => 1
  * resolution:  duplicate =>
  * needs_tests:  0 => 1

Comment:

 I know this a duplicate ticket, BUT the previous ticket for was Django
 version 1.1.1.
 Django 1.2+ needs to have patches in two files to get this issue fixed.

 changes to django/forms/models.py from line 984:

 {{{
 def to_python(self, value):
 if value in EMPTY_VALUES:
 return None
 try:
 key = self.to_field_name or 'pk'
 value = self.queryset.get(**{key: value})
 except (ValueError, self.queryset.model.DoesNotExist):
 raise ValidationError(self.error_messages['invalid_choice'])
 return value

 }}}

 And django/contrib/admin/widgets.py



 {{{
 def label_for_value(self, value):
 key = self.rel.get_related_field().name
 try:
 obj = self.rel.to._default_manager.using(self.db).get(**{key:
 value})
 return '%s' %
 escape(truncate_words(obj, 14))
 except (ValueError, self.rel.to.DoesNotExist):
 return ''

 }}}

 Applying both of these patches seems to fix the issue. It would be nice to
 have this fixed in the next Django 1.2.2 release.

-- 
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] #13606: admin raw_id_fields fail to check against non-numerical input

2010-05-24 Thread Django
#13606: admin raw_id_fields fail to check against non-numerical input
---+
  Reporter:  petrikuitti...@yahoo.com  | Owner:  nobody
Status:  closed| Milestone:
 Component:  django.contrib.admin  |   Version:  1.2   
Resolution:  duplicate |  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by petrikuitti...@yahoo.com):

 Replying to [comment:1 kmtracey]:
 > Isn't this #13149? We only need one ticket to track getting it fixed.

 Yes. It is the same issue indeed. Unfortunately the patch in #13149
 doesn't solve the problem in Django-1.2.1. I don't know why. The patch
 works for Django-1.2-beta though.

-- 
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] #13606: admin raw_id_fields fail to check against non-numerical input

2010-05-24 Thread Django
#13606: admin raw_id_fields fail to check against non-numerical input
---+
  Reporter:  petrikuitti...@yahoo.com  | Owner:  nobody
Status:  closed| Milestone:
 Component:  django.contrib.admin  |   Version:  1.2   
Resolution:  duplicate |  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by kmtracey):

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

Comment:

 Isn't this #13149? We only need one ticket to track getting it 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 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] #13606: admin raw_id_fields fail to check against non-numerical input

2010-05-24 Thread Django
#13606: admin raw_id_fields fail to check against non-numerical input
--+-
 Reporter:  petrikuitti...@yahoo.com  |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  django.contrib.admin  | Version:  1.2   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 Inputting a non-numerical value in a foreign key field using
 raw_input_fields produces a ValueError exception in django admin.
 E.g write "wer" to any foreign key field, which has been declared with
 raw_input_fields fails:

 {{{
 Django Version: 1.2.1
 Exception Type: ValueError
 Exception Value:
 invalid literal for int() with base 10: 'wer'
 }}}


 Using Django 1.2-beta I was able to fix this bug by simply appending these
 two lines to
 django/contrib/admin/widgets.py label_for_value()-function:


 {{{
 def label_for_value(self, value):
 key = self.rel.get_related_field().name
 try:
 obj = self.rel.to._default_manager.using(self.db).get(**{key:
 value})
 except self.rel.to.DoesNotExist:
 return ''
 # simple fix
 except ValueError:
 return ''
 # end of fix
 return '%s' % escape(truncate_words(obj,
 14))
 }}}


 Now in Django 1.2.1 this fix unfortunately doesn't work.

-- 
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.