Skip to content

Commit

Permalink
⬆️ django 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Apr 18, 2024
1 parent 96759b6 commit c94418a
Show file tree
Hide file tree
Showing 24 changed files with 265 additions and 264 deletions.
4 changes: 2 additions & 2 deletions mediathread/assetmgr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.core.cache import cache
from django.urls import reverse
from django.db import models
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str
from tagging.models import Tag

from mediathread.assetmgr.custom_storage import private_storage
Expand Down Expand Up @@ -378,7 +378,7 @@ class Source(models.Model):
auto_now=True)

def __str__(self):
return '[%s] %s' % (self.label, smart_text(self.asset))
return '[%s] %s' % (self.label, smart_str(self.asset))

def is_image(self):
return (self.label == 'poster' or
Expand Down
10 changes: 5 additions & 5 deletions mediathread/assetmgr/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.core.cache import cache
from django.test import TestCase
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str

from mediathread.assetmgr.models import Asset, Source, METADATA_ORIGINAL_OWNER
from mediathread.djangosherd.models import SherdNote
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_unicode(self):
primary_source='image',
author=self.instructor_one,
title="Item Title")
self.assertEqual(smart_text(asset1),
self.assertEqual(smart_str(asset1),
'Item Title <%s> (Sample Course)' % asset1.id)

def test_get_by_args(self):
Expand Down Expand Up @@ -357,17 +357,17 @@ def test_assets_by_course_and_user(self):
self.assertEqual(assets.count(), 0)

def test_source_unicode(self):
desc = smart_text(self.asset1.primary)
desc = smart_str(self.asset1.primary)
self.assertTrue('[image]' in desc)
self.assertTrue('Sample Course' in desc)

def test_external_collection_unicode(self):
collection = ExternalCollectionFactory()
self.assertEqual(smart_text(collection), 'collection')
self.assertEqual(smart_str(collection), 'collection')

def test_suggested_external_collection_unicode(self):
collection = SuggestedExternalCollectionFactory()
self.assertEqual(smart_text(collection), 'collection')
self.assertEqual(smart_str(collection), 'collection')

def test_html_source(self):
with self.assertRaises(Source.DoesNotExist):
Expand Down
5 changes: 3 additions & 2 deletions mediathread/discussions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.encoding import smart_text
from django.utils.encoding import smart_bytes
from django.utils import timezone
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_POST
Expand Down Expand Up @@ -313,7 +313,8 @@ def threaded_comment_json(request, comment):

return {
'type': 'discussion',
'form': smart_text(django_comments.get_form()(comment.content_object)),
'form': smart_bytes(
django_comments.get_form()(comment.content_object)),
'editing': True,
'can_edit': True,
'discussion': {
Expand Down
4 changes: 2 additions & 2 deletions mediathread/djangosherd/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.urls import reverse
from django.db import models
from django.db.models.query_utils import Q
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str
from django_comments.models import Comment
from tagging.fields import TagField
from tagging.models import Tag, TaggedItem
Expand Down Expand Up @@ -444,7 +444,7 @@ class DiscussionIndex(models.Model):
modified = models.DateTimeField(auto_now=True) # update on save

def __str__(self):
return smart_text(self.body)
return smart_str(self.body)

@property
def body(self):
Expand Down
4 changes: 2 additions & 2 deletions mediathread/main/clumper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from functools import total_ordering, cmp_to_key

from django.utils.encoding import smart_text
from django.utils.encoding import smart_str
from django_comments.models import Comment
from mediathread.assetmgr.models import Asset
from mediathread.djangosherd.models import SherdNote, DiscussionIndex
Expand Down Expand Up @@ -60,7 +60,7 @@ def __lt__(self, other):
return self.order_by(self.things[0], other.things[0]) < 0

def __str__(self):
return smart_text(self.things[0])
return smart_str(self.things[0])

def append(self, obj):
if len(self.things) < 4:
Expand Down
4 changes: 2 additions & 2 deletions mediathread/main/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.test.client import RequestFactory
from django.test.testcases import TestCase
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str

from mediathread.factories import (
MediathreadTestMixin, UserFactory, UserProfileFactory, CourseFactory,
Expand Down Expand Up @@ -43,7 +43,7 @@ class UserProfileTest(TestCase):
def test_unicode(self):
user = UserFactory(username='johndoe')
profile = UserProfileFactory(user=user)
self.assertEquals(smart_text(profile), 'johndoe')
self.assertEqual(smart_str(profile), 'johndoe')


class UserRegistrationTest(TestCase):
Expand Down
Loading

0 comments on commit c94418a

Please sign in to comment.