mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Merge pull request #900 from bmispelon/ticket-20022
Fix #20022: Correctly handle prefixes with url-unsafe characters in reverse()
This commit is contained in:
30
tests/shared_models/models.py
Normal file
30
tests/shared_models/models.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
class Tag(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Author(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Book(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
pages = models.IntegerField(default=0)
|
||||
author = models.ForeignKey(Author, null=True)
|
||||
pubdate = models.DateTimeField()
|
||||
tags = models.ManyToManyField(Tag)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-pubdate', 'name']
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
Reference in New Issue
Block a user