Remove our copy of the slugify() implementation
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
"""
|
||||
Utilities for django models.
|
||||
"""
|
||||
import re
|
||||
import unicodedata
|
||||
|
||||
from django.conf import settings
|
||||
from django.dispatch import Signal
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.utils.safestring import mark_safe
|
||||
from django_countries.fields import Country
|
||||
|
||||
from eventtracking import tracker
|
||||
@@ -171,20 +166,3 @@ def _get_truncated_setting_value(value, max_length=None):
|
||||
return value[0:max_length], True
|
||||
else:
|
||||
return value, False
|
||||
|
||||
|
||||
# Taken from Django 1.8 source code because it's not supported in 1.4
|
||||
def slugify(value):
|
||||
"""Converts value into a string suitable for readable URLs.
|
||||
|
||||
Converts to ASCII. Converts spaces to hyphens. Removes characters that
|
||||
aren't alphanumerics, underscores, or hyphens. Converts to lowercase.
|
||||
Also strips leading and trailing whitespace.
|
||||
|
||||
Args:
|
||||
value (string): String to slugify.
|
||||
"""
|
||||
value = force_unicode(value)
|
||||
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
|
||||
value = re.sub(r'[^\w\s-]', '', value).strip().lower()
|
||||
return mark_safe(re.sub(r'[-\s]+', '-', value))
|
||||
|
||||
@@ -5,7 +5,7 @@ import hashlib
|
||||
import logging
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.template.defaultfilters import slugify
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from badges.models import BadgeAssertion, BadgeClass, CourseCompleteImageConfiguration
|
||||
|
||||
@@ -64,7 +64,7 @@ from student.roles import CourseBetaTesterRole
|
||||
from track import contexts
|
||||
from util import milestones_helpers
|
||||
from util.json_request import JsonResponse
|
||||
from util.model_utils import slugify
|
||||
from django.utils.text import slugify
|
||||
from util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.contentstore.django import contentstore
|
||||
|
||||
@@ -27,7 +27,7 @@ from lms.djangoapps.teams import TEAM_DISCUSSION_CONTEXT
|
||||
from lms.djangoapps.teams.utils import emit_team_event
|
||||
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
|
||||
from student.models import CourseEnrollment, LanguageField
|
||||
from util.model_utils import slugify
|
||||
from django.utils.text import slugify
|
||||
|
||||
from .errors import AlreadyOnTeamInCourse, ImmutableMembershipFieldException, NotEnrolledInCourseForTeam
|
||||
|
||||
|
||||
Reference in New Issue
Block a user