Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated admin.site.root_path references, replace with reverse() #1

Open
wants to merge 1 commit into
base: e4222a6d95cbfbd51dbc1219e65f22c384b5f54d^
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cms/admin/pageadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,15 @@ def changelist_view(self, request, extra_context=None):
else:
languages = [x[0] for x in settings.CMS_LANGUAGES]

root_path = reverse('admin:index')

context = {
'title': cl.title,
'is_popup': cl.is_popup,
'cl': cl,
'opts':opts,
'has_add_permission': self.has_add_permission(request),
'root_path': self.admin_site.root_path,
'root_path': root_path,
'app_label': app_label,
'CMS_MEDIA_URL': settings.CMS_MEDIA_URL,
'softroot': settings.CMS_SOFTROOT,
Expand Down
6 changes: 4 additions & 2 deletions cms/utils/mail.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _

from django.contrib import admin
from django.contrib.sites.models import Site

from cms.utils.urlutils import urljoin
Expand All @@ -15,8 +15,10 @@ def send_mail(subject, txt_template, to, context=None, html_template=None, fail_
site = Site.objects.get_current()

context = context or {}

root_path = reverse('admin:index')
context.update({
'login_url': "http://%s" % urljoin(site.domain, admin.site.root_path),
'login_url': "http://%s" % urljoin(site.domain, root_path),
'title': subject,
})

Expand Down
7 changes: 5 additions & 2 deletions cms/utils/moderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,21 @@ def mail_approvement_request(page, user=None):
if not recipient_list:
return

from django.contrib import admin
from django.contrib.sites.models import Site
from cms.utils.urlutils import urljoin
from cms.utils.mail import send_mail
from django.core.urlresolvers import reverse


site = Site.objects.get_current()

subject = _('CMS - Page %s requires approvement.') % unicode(page)
root_path = reverse('admin:index')
assert False, root_path

context = {
'page': page,
'admin_url': "http://%s" % urljoin(site.domain, admin.site.root_path, 'cms/page', page.id),
'admin_url': "http://%s" % urljoin(site.domain, root_path, 'cms/page', page.id),
}

send_mail(subject, 'admin/cms/mail/approvement_required.txt', recipient_list, context, 'admin/cms/mail/approvement_required.html')