summaryrefslogtreecommitdiff
path: root/tests/contenttypes_tests/models.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-16 15:54:00 -0500
committerTim Graham <timograham@gmail.com>2015-02-16 17:45:38 -0500
commit664c038f2c5b56d1ce929243d29cd4e11ea5f9ea (patch)
tree1415dc3fa702a16d2a8cffbd932ec4ae728e6423 /tests/contenttypes_tests/models.py
parent35f0cae19de226d9d7771304fc8dd2619e644998 (diff)
Moved contrib.contenttypes tests out of contrib.
Diffstat (limited to 'tests/contenttypes_tests/models.py')
-rw-r--r--tests/contenttypes_tests/models.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/contenttypes_tests/models.py b/tests/contenttypes_tests/models.py
index dadc40d3d9..15148cdebd 100644
--- a/tests/contenttypes_tests/models.py
+++ b/tests/contenttypes_tests/models.py
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.http import urlquote
@python_2_unicode_compatible
@@ -35,3 +36,43 @@ class SchemeIncludedURL(models.Model):
def get_absolute_url(self):
return self.url
+
+
+class ConcreteModel(models.Model):
+ name = models.CharField(max_length=10)
+
+
+class ProxyModel(ConcreteModel):
+ class Meta:
+ proxy = True
+
+
+@python_2_unicode_compatible
+class FooWithoutUrl(models.Model):
+ """
+ Fake model not defining ``get_absolute_url`` for
+ ContentTypesTests.test_shortcut_view_without_get_absolute_url()
+ """
+ name = models.CharField(max_length=30, unique=True)
+
+ def __str__(self):
+ return self.name
+
+
+class FooWithUrl(FooWithoutUrl):
+ """
+ Fake model defining ``get_absolute_url`` for
+ ContentTypesTests.test_shortcut_view().
+ """
+
+ def get_absolute_url(self):
+ return "/users/%s/" % urlquote(self.name)
+
+
+class FooWithBrokenAbsoluteUrl(FooWithoutUrl):
+ """
+ Fake model defining a ``get_absolute_url`` method containing an error
+ """
+
+ def get_absolute_url(self):
+ return "/users/%s/" % self.unknown_field