Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-05-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nott
 Type:  Bug |   Status:  closed
Component:  contrib.admin   |  Version:  1.6
 Severity:  Normal  |   Resolution:  fixed
 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 Russell Keith-Magee ):

 In [changeset:"75d2da797e100442d3573dfa7ae490972cea32d8"]:
 {{{
 #!CommitTicketReference repository=""
 revision="75d2da797e100442d3573dfa7ae490972cea32d8"
 [1.7.x] Fixed #22266 - quote PK before redirecting away from add_view
 (django.contrib.admin)

 Backport of ebd70d4d00c252d5122c13906da5bddc8de0bce5 from master.
 }}}

-- 
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/084.7c84697e0ea5d3bd746eb37bd97c1bc5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-05-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nott
 Type:  Bug |   Status:  closed
Component:  contrib.admin   |  Version:  1.6
 Severity:  Normal  |   Resolution:  fixed
 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 Russell Keith-Magee ):

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


Comment:

 In [changeset:"ebd70d4d00c252d5122c13906da5bddc8de0bce5"]:
 {{{
 #!CommitTicketReference repository=""
 revision="ebd70d4d00c252d5122c13906da5bddc8de0bce5"
 Fixed #22266 - quote PK before redirecting away from add_view
 (django.contrib.admin)
 }}}

-- 
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/084.0a923c8d1f9d1f1ed0371d2b406b38a9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-05-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nott
 Type:  Bug |   Status:  assigned
Component:  contrib.admin   |  Version:  1.6
 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 nott):

 Pull request: https://github.com/django/django/pull/2666/

-- 
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/084.6bddfa72695ba7ab123a58f15b7e692c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-05-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nott
 Type:  Bug |   Status:  assigned
Component:  contrib.admin   |  Version:  1.6
 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 nott):

 ModelAdmin.get_urls defines the urls like these:
 {{{
 url(r'^$', wrap(self.changelist_view), name='%s_%s_changelist'
 % info),
 url(r'^add/$', wrap(self.add_view), name='%s_%s_add' % info),
 url(r'^(.+)/history/$', wrap(self.history_view),
 name='%s_%s_history' % info),
 url(r'^(.+)/delete/$', wrap(self.delete_view),
 name='%s_%s_delete' % info),
 url(r'^(.+)/$', wrap(self.change_view), name='%s_%s_change' %
 info),
 }}}

 As long as we do not know the exact primary key regexp, we have to use
 (.+)
 Consider we have 2 entries with the following PKs: "test_123" and
 "test_123/history". There is no way to distinguish change view for
 "test_123/history" and history view for "test_123".
 That is why PK quoting was introduced. django.contrib.admin.utils contains
 2 functions: quote and unquote. So reversing admin url should usually look
 like:
 {{{
 reverse('admin:app_model_change', args=(quote(pk),))
 }}}

 Quoting and unquoting doesn't change numerical PKs, that is why this
 problem haven't been noticed before.
 By the way, there is a bug with quoting not being applied in add_view, but
 it can be easily fixed.

 I suppose we are really lacking the documentation
 (https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#overriding-vs-
 replacing-an-admin-template is evertyhing I could find).

 There is no way to get rid of quoting if we leave (.+) url pattern for PK.
 So we can leave everything as is.
 We still can make this pattern configurable, e.g.:
 {{{
 class ModelAdmin(BaseModelAdmin):
 [...]
 pk_regexp = ".+"
 [...]
 def get_pk_regexp(self):
 return self.pk_regexp
 }}}

-- 
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/084.91979407f441953dfb7fa0c434208d6a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-05-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nott
 Type:  Bug |   Status:  assigned
Component:  contrib.admin   |  Version:  1.6
 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 nott):

 This issue is not related to #3

-- 
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/084.3ff5a05a2b491ee1e0029006277a12e4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-05-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nott
 Type:  Bug |   Status:  assigned
Component:  contrib.admin   |  Version:  1.6
 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 nott):

 * owner:  nobody => nott
 * status:  new => assigned


-- 
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/084.8d2f9d0cac47beb622e99181e361cb11%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-03-16 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  contrib.admin   |  Version:  1.6
 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 timo):

 * stage:  Unreviewed => 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/084.33da945b3cb79f80cd9c27e1678212a8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-03-13 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+--
 Reporter:  victor.varvariuc@…  |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  contrib.admin   |  Version:  1.6
 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
+--
Changes (by claudep):

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


Comment:

 Might be related to #3

-- 
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/084.59cbb0fc47c68a9c056239053a6d607b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #22266: CharField primary keys with underscores are (un)escaped differently in the admin pages

2014-03-13 Thread Django
#22266: CharField primary keys with underscores are (un)escaped differently in 
the
admin pages
+
 Reporter:  victor.varvariuc@…  |  Owner:  nobody
 Type:  Bug | Status:  new
Component:  contrib.admin   |Version:  1.6
 Severity:  Normal  |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0   |  UI/UX:  0
+
 Migrated from here: https://code.djangoproject.com/ticket/18381#comment:6

 Although that bug was fixed 2 years ago, related issues seem still present
 in the latest stable Django release 1.6.2.
 CharField primary keys with underscores are (un)escaped differently in the
 admin pages, and when reversing admin URLs with
 django.core.urlresolvers.reverse() or the {% url %} template tag.
 The admin pages add "5F" after the underscore in when rendering URLs, but
 reverse() does not. As a result, links from custom pages into the admin
 break when the object's primary key contains underscores.

 Steps to reproduce:
 - Create a model with "id = models.CharField(max_length=100,
 primary_key=True)" or other similar text primary key field,
 - Register the model to the admin site,
 - Create a model instance with test_123 as the primary key,
 - Visit the admin, and observe admin URLs: they are of the format
 "/admin///test_5F123/"
 - Open the shell, and call reverse('admin:app_model_delete',
 args=['test_123'])
 - The URLs returned are of the format "/admin///test_123/" -
 no 5F
 - As a result, if these links are embedded in pages, they don't work - the
 admin page tries to decode the primary key, expects 5F, and does not find
 the object.

 {{{
 [trains] vic@vic ~/projects/trains (master *) $ ./manage.py shell
 Python 3.3.2+ (default, Oct  9 2013, 14:50:09)

 >>> from django.core.urlresolvers import reverse

 >>> reverse('admin:trains_route_change', args=('test_123',))
 >>> '/trains/route/test_123/'
 }}}

-- 
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.6f349640f1d9d38fe1b19114c1d2028c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.