Ticket #14543: 14543.2.patch

File 14543.2.patch, 1.5 KB (added by crayz_train, 14 years ago)

diff works against r15821

  • django/contrib/contenttypes/tests.py

    diff --git a/django/contrib/contenttypes/tests.py b/django/contrib/contenttypes/tests.py
    index 790193b..a26956d 100644
    a b  
     1import urllib
    12from django import db
    23from django.conf import settings
    34from django.contrib.contenttypes.models import ContentType
    from django.contrib.contenttypes.views import shortcut  
    67from django.core.exceptions import ObjectDoesNotExist
    78from django.http import HttpRequest
    89from django.test import TestCase
     10from django.db import models
     11from django.utils.translation import ugettext_lazy as _
     12from django.utils.encoding import smart_str
    913
     14class User(models.Model):
     15    """fake User table for test_shortcut_view"""
     16    username = models.CharField(_('username'), max_length=30, unique=True, help_text=_("Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters"))
     17    class Meta:
     18        verbose_name = _('user')
     19        verbose_name_plural = _('users')
     20
     21    def __unicode__(self):
     22        return self.username
     23
     24    def get_absolute_url(self):
     25        return "/users/%s/" % urllib.quote(smart_str(self.username))
    1026
    1127class ContentTypesTests(TestCase):
    1228
    class ContentTypesTests(TestCase):  
    5874            "SERVER_NAME": "Example.com",
    5975            "SERVER_PORT": "80",
    6076        }
    61         from django.contrib.auth.models import User
    6277        user_ct = ContentType.objects.get_for_model(User)
    6378        obj = User.objects.create(username="john")
    6479
Back to Top