Commit 1059da8d authored by Jacob Kaplan-Moss's avatar Jacob Kaplan-Moss Committed by Florian Apolloner
Browse files

Merge pull request #900 from bmispelon/ticket-20022

Fix #20022: Correctly handle prefixes with url-unsafe characters in reverse()
parents 5d8342f3 4fa7f3cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ class RegexURLResolver(LocaleRegexProvider):
                    if len(args) != len(params) + len(prefix_args):
                        continue
                    unicode_args = [force_text(val) for val in args]
                    candidate = (prefix_norm + result) % dict(zip(prefix_args + params, unicode_args))
                    candidate = (prefix_norm.replace('%', '%%') + result) % dict(zip(prefix_args + params, unicode_args))
                else:
                    if set(kwargs.keys()) | set(defaults.keys()) != set(params) | set(defaults.keys()) | set(prefix_args):
                        continue
+5 −16
Original line number Diff line number Diff line
@@ -10,29 +10,16 @@ from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible

from shared_models.models import Author, Book

class Author(models.Model):
    name = models.CharField(max_length=100)
    class Meta:
        ordering = ('name', )

@python_2_unicode_compatible
class Article(models.Model):
    headline = models.CharField(max_length=100)
    pub_date = models.DateTimeField()
    author = models.ForeignKey(Author, blank=True, null=True)
    class Meta:
        ordering = ('-pub_date', 'headline')

    def __str__(self):
        return self.headline

class Tag(models.Model):
    articles = models.ManyToManyField(Article)
    articles = models.ManyToManyField(Book)
    name = models.CharField(max_length=100)
    class Meta:
        ordering = ('name', )


@python_2_unicode_compatible
class Season(models.Model):
    year = models.PositiveSmallIntegerField()
@@ -41,6 +28,7 @@ class Season(models.Model):
    def __str__(self):
        return six.text_type(self.year)


@python_2_unicode_compatible
class Game(models.Model):
    season = models.ForeignKey(Season, related_name='games')
@@ -50,6 +38,7 @@ class Game(models.Model):
    def __str__(self):
        return "%s at %s" % (self.away, self.home)


@python_2_unicode_compatible
class Player(models.Model):
    name = models.CharField(max_length=100)
+394 −391

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR
SUBDIRS_TO_SKIP = ['templates']

ALWAYS_INSTALLED_APPS = [
    'shared_models',
    'django.contrib.contenttypes',
    'django.contrib.auth',
    'django.contrib.sites',
+0 −0

Empty file added.

Loading