diff --git a/docs/usage.rst b/docs/usage.rst index d54c5f1f..9a1b5700 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -158,7 +158,7 @@ view). The value is a URL that points to a view that fills a list of 2-tuples Create the widget:: from django import forms - from django.core.urlresolvers import reverse + from django.urls import reverse from tinymce.widgets import TinyMCE class SomeForm(forms.Form): @@ -189,9 +189,9 @@ the flatpages ``content`` field with a predefined list of other flatpages in the link dialog you could use something like this:: from django import forms - from django.core.urlresolvers import reverse from django.contrib.flatpages.admin import FlatPageAdmin from django.contrib.flatpages.models import FlatPage + from django.urls import reverse from tinymce.widgets import TinyMCE class TinyMCEFlatPageAdmin(FlatPageAdmin): @@ -238,7 +238,7 @@ provides a view and a template tag to make supporting this plugin easier. To use it point the ``plugin_preview_pageurl`` configuration to the view named ``tinymce-preview``:: - from django.core.urlresolvers import reverse + from django.urls import reverse widget = TinyMCE(mce_attrs={'plugin_preview_pageurl': reverse('tinymce-preview', "NAME")}) The view named by ``tinymce-preview`` looks for a template named either diff --git a/testtinymce/urls.py b/testtinymce/urls.py index b424d4b1..7db9b2d1 100644 --- a/testtinymce/urls.py +++ b/testtinymce/urls.py @@ -1,14 +1,12 @@ -from django.conf.urls import include, url from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.urls import include, path import tinymce.urls -admin.autodiscover() - urlpatterns = [ - url(r"^tinymce/", include(tinymce.urls)), - url(r"^admin/", admin.site.urls), + path("tinymce/", include(tinymce.urls)), + path("admin/", admin.site.urls), ] urlpatterns += staticfiles_urlpatterns() diff --git a/tinymce/urls.py b/tinymce/urls.py index 94ce33a5..7042e86c 100644 --- a/tinymce/urls.py +++ b/tinymce/urls.py @@ -1,12 +1,12 @@ # Copyright (c) 2008 Joost Cassee # Licensed under the terms of the MIT License (see LICENSE.txt) -from django.conf.urls import url +from django.urls import path from tinymce import views urlpatterns = [ - url(r"^spellchecker/$", views.spell_check, name="tinymce-spellcheck"), - url(r"^flatpages_link_list/$", views.flatpages_link_list, name="tinymce-linklist"), - url(r"^compressor/$", views.compressor, name="tinymce-compressor"), - url(r"^filebrowser/$", views.filebrowser, name="tinymce-filebrowser"), + path("spellchecker/", views.spell_check, name="tinymce-spellcheck"), + path("flatpages_link_list/", views.flatpages_link_list, name="tinymce-linklist"), + path("compressor/", views.compressor, name="tinymce-compressor"), + path("filebrowser/", views.filebrowser, name="tinymce-filebrowser"), ] diff --git a/tinymce/views.py b/tinymce/views.py index 89ed89b7..1401ba5c 100644 --- a/tinymce/views.py +++ b/tinymce/views.py @@ -8,7 +8,7 @@ from django.shortcuts import render from django.urls import reverse from django.utils.encoding import force_text -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views.decorators.csrf import csrf_exempt from tinymce.compressor import gzip_compressor diff --git a/tinymce/widgets.py b/tinymce/widgets.py index 0534786c..890a6884 100644 --- a/tinymce/widgets.py +++ b/tinymce/widgets.py @@ -12,19 +12,14 @@ from django.conf import settings from django.contrib.admin import widgets as admin_widgets from django.forms.utils import flatatt +from django.urls import reverse from django.utils.encoding import force_text from django.utils.html import escape from django.utils.safestring import mark_safe -from django.utils.translation import get_language, ugettext as _ +from django.utils.translation import get_language, gettext as _ import tinymce.settings -try: - from django.urls import reverse -except ImportError: - # Django < 1.10 - from django.core.urlresolvers import reverse - class TinyMCE(forms.Textarea): """