magic-removal: renamed DjangoContext to RequestContext and moved it to django.template. Updated dependencies.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5a54e18f9b
commit
042d1df0e7
|
@ -102,7 +102,7 @@ TEMPLATE_LOADERS = (
|
||||||
# 'django.template.loaders.eggs.load_template_source',
|
# 'django.template.loaders.eggs.load_template_source',
|
||||||
)
|
)
|
||||||
|
|
||||||
# List of processors used by DjangoContext to populate the context.
|
# List of processors used by RequestContext to populate the context.
|
||||||
# Each one should be a callable that takes the request object as its
|
# Each one should be a callable that takes the request object as its
|
||||||
# only parameter and returns a dictionary to add to the context.
|
# only parameter and returns a dictionary to add to the context.
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import models
|
||||||
from django.db.models.query import handle_legacy_orderlist
|
from django.db.models.query import handle_legacy_orderlist
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.core.paginator import ObjectPaginator, InvalidPage
|
from django.core.paginator import ObjectPaginator, InvalidPage
|
||||||
from django.core.extensions import DjangoContext as Context
|
from django.template import RequestContext as Context
|
||||||
from django.core.extensions import render_to_response
|
from django.core.extensions import render_to_response
|
||||||
from django.utils.dates import MONTHS
|
from django.utils.dates import MONTHS
|
||||||
# The system will display a "Show all" link only if the total result count
|
# The system will display a "Show all" link only if the total result count
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
from django.conf.settings import SECRET_KEY
|
from django.conf.settings import SECRET_KEY
|
||||||
from django.contrib.auth.models import User, SESSION_KEY
|
from django.contrib.auth.models import User, SESSION_KEY
|
||||||
from django import http
|
from django import http
|
||||||
|
@ -24,7 +25,7 @@ def _display_login_form(request, error_message=''):
|
||||||
'app_path': request.path,
|
'app_path': request.path,
|
||||||
'post_data': post_data,
|
'post_data': post_data,
|
||||||
'error_message': error_message
|
'error_message': error_message
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
def _encode_post_data(post_data):
|
def _encode_post_data(post_data):
|
||||||
pickled = pickle.dumps(post_data)
|
pickled = pickle.dumps(post_data)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from django import template, templatetags
|
from django import template, templatetags
|
||||||
|
from django.template import RequestContext
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.admin.views.decorators import staff_member_required
|
from django.contrib.admin.views.decorators import staff_member_required
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
from django.core.exceptions import ViewDoesNotExist
|
from django.core.exceptions import ViewDoesNotExist
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.core import urlresolvers
|
from django.core import urlresolvers
|
||||||
|
@ -16,7 +17,7 @@ MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_')
|
||||||
def doc_index(request):
|
def doc_index(request):
|
||||||
if not utils.docutils_is_available:
|
if not utils.docutils_is_available:
|
||||||
return missing_docutils_page(request)
|
return missing_docutils_page(request)
|
||||||
return render_to_response('admin_doc/index', context_instance=DjangoContext(request))
|
return render_to_response('admin_doc/index', context_instance=RequestContext(request))
|
||||||
doc_index = staff_member_required(doc_index)
|
doc_index = staff_member_required(doc_index)
|
||||||
|
|
||||||
def bookmarklets(request):
|
def bookmarklets(request):
|
||||||
|
@ -24,7 +25,7 @@ def bookmarklets(request):
|
||||||
admin_root = request.path[:-len('doc/bookmarklets/')]
|
admin_root = request.path[:-len('doc/bookmarklets/')]
|
||||||
return render_to_response('admin_doc/bookmarklets', {
|
return render_to_response('admin_doc/bookmarklets', {
|
||||||
'admin_url': "%s://%s%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', request.META['HTTP_HOST'], admin_root),
|
'admin_url': "%s://%s%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', request.META['HTTP_HOST'], admin_root),
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
bookmarklets = staff_member_required(bookmarklets)
|
bookmarklets = staff_member_required(bookmarklets)
|
||||||
|
|
||||||
def template_tag_index(request):
|
def template_tag_index(request):
|
||||||
|
@ -55,7 +56,7 @@ def template_tag_index(request):
|
||||||
'library': tag_library,
|
'library': tag_library,
|
||||||
})
|
})
|
||||||
|
|
||||||
return render_to_response('admin_doc/template_tag_index', {'tags': tags}, context_instance=DjangoContext(request))
|
return render_to_response('admin_doc/template_tag_index', {'tags': tags}, context_instance=RequestContext(request))
|
||||||
template_tag_index = staff_member_required(template_tag_index)
|
template_tag_index = staff_member_required(template_tag_index)
|
||||||
|
|
||||||
def template_filter_index(request):
|
def template_filter_index(request):
|
||||||
|
@ -85,7 +86,7 @@ def template_filter_index(request):
|
||||||
'meta': metadata,
|
'meta': metadata,
|
||||||
'library': tag_library,
|
'library': tag_library,
|
||||||
})
|
})
|
||||||
return render_to_response('admin_doc/template_filter_index', {'filters': filters}, context_instance=DjangoContext(request))
|
return render_to_response('admin_doc/template_filter_index', {'filters': filters}, context_instance=RequestContext(request))
|
||||||
template_filter_index = staff_member_required(template_filter_index)
|
template_filter_index = staff_member_required(template_filter_index)
|
||||||
|
|
||||||
def view_index(request):
|
def view_index(request):
|
||||||
|
@ -105,7 +106,7 @@ def view_index(request):
|
||||||
'site': Site.objects.get_object(pk=settings_mod.SITE_ID),
|
'site': Site.objects.get_object(pk=settings_mod.SITE_ID),
|
||||||
'url': simplify_regex(regex),
|
'url': simplify_regex(regex),
|
||||||
})
|
})
|
||||||
return render_to_response('admin_doc/view_index', {'views': views}, context_instance=DjangoContext(request))
|
return render_to_response('admin_doc/view_index', {'views': views}, context_instance=RequestContext(request))
|
||||||
view_index = staff_member_required(view_index)
|
view_index = staff_member_required(view_index)
|
||||||
|
|
||||||
def view_detail(request, view):
|
def view_detail(request, view):
|
||||||
|
@ -129,7 +130,7 @@ def view_detail(request, view):
|
||||||
'summary': title,
|
'summary': title,
|
||||||
'body': body,
|
'body': body,
|
||||||
'meta': metadata,
|
'meta': metadata,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
view_detail = staff_member_required(view_detail)
|
view_detail = staff_member_required(view_detail)
|
||||||
|
|
||||||
def model_index(request):
|
def model_index(request):
|
||||||
|
@ -145,7 +146,7 @@ def model_index(request):
|
||||||
'module': opts.app_label,
|
'module': opts.app_label,
|
||||||
'class': opts.module_name,
|
'class': opts.module_name,
|
||||||
})
|
})
|
||||||
return render_to_response('admin_doc/model_index', {'models': models}, context_instance=DjangoContext(request))
|
return render_to_response('admin_doc/model_index', {'models': models}, context_instance=RequestContext(request))
|
||||||
model_index = staff_member_required(model_index)
|
model_index = staff_member_required(model_index)
|
||||||
|
|
||||||
def model_detail(request, model):
|
def model_detail(request, model):
|
||||||
|
@ -187,7 +188,7 @@ def model_detail(request, model):
|
||||||
'name': '%s.%s' % (opts.app_label, opts.module_name),
|
'name': '%s.%s' % (opts.app_label, opts.module_name),
|
||||||
'summary': "Fields on %s objects" % opts.verbose_name,
|
'summary': "Fields on %s objects" % opts.verbose_name,
|
||||||
'fields': fields,
|
'fields': fields,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
model_detail = staff_member_required(model_detail)
|
model_detail = staff_member_required(model_detail)
|
||||||
|
|
||||||
def template_detail(request, template):
|
def template_detail(request, template):
|
||||||
|
@ -207,7 +208,7 @@ def template_detail(request, template):
|
||||||
return render_to_response('admin_doc/template_detail', {
|
return render_to_response('admin_doc/template_detail', {
|
||||||
'name': template,
|
'name': template,
|
||||||
'templates': templates,
|
'templates': templates,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
template_detail = staff_member_required(template_detail)
|
template_detail = staff_member_required(template_detail)
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.template import loader
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
||||||
from django.core.extensions import DjangoContext as Context
|
from django.template import RequestContext as Context
|
||||||
from django.core.extensions import get_object_or_404, render_to_response
|
from django.core.extensions import get_object_or_404, render_to_response
|
||||||
from django.utils import dateformat
|
from django.utils import dateformat
|
||||||
from django.utils.html import escape, strip_tags
|
from django.utils.html import escape, strip_tags
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.core import formfields
|
||||||
from django import template
|
from django import template
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
||||||
from django.core.extensions import DjangoContext as Context
|
from django.template import RequestContext as Context
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.utils.text import capfirst, get_text_list
|
from django.utils.text import capfirst, get_text_list
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.core import formfields
|
||||||
from django import template
|
from django import template
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
||||||
from django.core.extensions import DjangoContext as Context
|
from django.template import RequestContext as Context
|
||||||
from django.contrib.admin.views.stages.modify import render_change_form
|
from django.contrib.admin.views.stages.modify import render_change_form
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.text import capfirst, get_text_list
|
from django.utils.text import capfirst, get_text_list
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.contrib.admin.views.decorators import staff_member_required
|
from django.contrib.admin.views.decorators import staff_member_required
|
||||||
from django.contrib.admin.views.main import get_model_and_app
|
from django.contrib.admin.views.main import get_model_and_app
|
||||||
from django.core.extensions import get_object_or_404,render_to_response
|
from django.core.extensions import get_object_or_404,render_to_response
|
||||||
from django.core.extensions import DjangoContext as Context
|
from django.template import RequestContext as Context
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.utils.html import escape, strip_tags
|
from django.utils.html import escape, strip_tags
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
|
@ -2,7 +2,8 @@ from django.contrib.admin.views.decorators import staff_member_required
|
||||||
from django.core import formfields, validators
|
from django.core import formfields, validators
|
||||||
from django import template
|
from django import template
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.template import RequestContext as Context
|
||||||
|
from django.core.extensions import render_to_response
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ def template_validator(request):
|
||||||
return render_to_response('admin/template_validator', {
|
return render_to_response('admin/template_validator', {
|
||||||
'title': 'Template validator',
|
'title': 'Template validator',
|
||||||
'form': formfields.FormWrapper(manipulator, new_data, errors),
|
'form': formfields.FormWrapper(manipulator, new_data, errors),
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
template_validator = staff_member_required(template_validator)
|
template_validator = staff_member_required(template_validator)
|
||||||
|
|
||||||
class TemplateValidator(formfields.Manipulator):
|
class TemplateValidator(formfields.Manipulator):
|
||||||
|
|
|
@ -2,7 +2,8 @@ from django.core import formfields, validators
|
||||||
from django.core.mail import mail_admins, mail_managers
|
from django.core.mail import mail_admins, mail_managers
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
from django.contrib.auth.models import SESSION_KEY
|
from django.contrib.auth.models import SESSION_KEY
|
||||||
from django.contrib.comments.models import Comment, FreeComment, PHOTOS_REQUIRED, PHOTOS_OPTIONAL, RATINGS_REQUIRED, RATINGS_OPTIONAL, IS_PUBLIC
|
from django.contrib.comments.models import Comment, FreeComment, PHOTOS_REQUIRED, PHOTOS_OPTIONAL, RATINGS_REQUIRED, RATINGS_OPTIONAL, IS_PUBLIC
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
@ -241,7 +242,7 @@ def post_comment(request):
|
||||||
'ratings_required': RATINGS_REQUIRED in option_list,
|
'ratings_required': RATINGS_REQUIRED in option_list,
|
||||||
'rating_range': rating_range,
|
'rating_range': rating_range,
|
||||||
'rating_choices': rating_choices,
|
'rating_choices': rating_choices,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
elif request.POST.has_key('post'):
|
elif request.POST.has_key('post'):
|
||||||
# If the IP is banned, mail the admins, do NOT save the comment, and
|
# If the IP is banned, mail the admins, do NOT save the comment, and
|
||||||
# serve up the "Thanks for posting" page as if the comment WAS posted.
|
# serve up the "Thanks for posting" page as if the comment WAS posted.
|
||||||
|
@ -304,7 +305,7 @@ def post_free_comment(request):
|
||||||
'options': options,
|
'options': options,
|
||||||
'target': target,
|
'target': target,
|
||||||
'hash': security_hash,
|
'hash': security_hash,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
elif request.POST.has_key('post'):
|
elif request.POST.has_key('post'):
|
||||||
# If the IP is banned, mail the admins, do NOT save the comment, and
|
# If the IP is banned, mail the admins, do NOT save the comment, and
|
||||||
# serve up the "Thanks for posting" page as if the comment WAS posted.
|
# serve up the "Thanks for posting" page as if the comment WAS posted.
|
||||||
|
@ -335,4 +336,4 @@ def comment_was_posted(request):
|
||||||
obj = content_type.get_object_for_this_type(pk=object_id)
|
obj = content_type.get_object_for_this_type(pk=object_id)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
pass
|
pass
|
||||||
return render_to_response('comments/posted', {'object': obj}, context_instance=DjangoContext(request))
|
return render_to_response('comments/posted', {'object': obj}, context_instance=RequestContext(request))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
from django.models.comments import comments, karma
|
from django.models.comments import comments, karma
|
||||||
|
|
||||||
def vote(request, comment_id, vote):
|
def vote(request, comment_id, vote):
|
||||||
|
@ -25,4 +26,4 @@ def vote(request, comment_id, vote):
|
||||||
karma.vote(request.user.id, comment_id, rating)
|
karma.vote(request.user.id, comment_id, rating)
|
||||||
# Reload comment to ensure we have up to date karma count
|
# Reload comment to ensure we have up to date karma count
|
||||||
comment = comments.get_object(pk=comment_id)
|
comment = comments.get_object(pk=comment_id)
|
||||||
return render_to_response('comments/karma_vote_accepted', {'comment': comment}, context_instance=DjangoContext(request))
|
return render_to_response('comments/karma_vote_accepted', {'comment': comment}, context_instance=RequestContext(request))
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.models.comments import comments, moderatordeletions, userflags
|
from django.models.comments import comments, moderatordeletions, userflags
|
||||||
from django.views.decorators.auth import login_required
|
from django.views.decorators.auth import login_required
|
||||||
|
@ -21,7 +22,7 @@ def flag(request, comment_id):
|
||||||
if request.POST:
|
if request.POST:
|
||||||
userflags.flag(comment, request.user)
|
userflags.flag(comment, request.user)
|
||||||
return HttpResponseRedirect('%sdone/' % request.path)
|
return HttpResponseRedirect('%sdone/' % request.path)
|
||||||
return render_to_response('comments/flag_verify', {'comment': comment}, context_instance=DjangoContext(request))
|
return render_to_response('comments/flag_verify', {'comment': comment}, context_instance=RequestContext(request))
|
||||||
flag = login_required(flag)
|
flag = login_required(flag)
|
||||||
|
|
||||||
def flag_done(request, comment_id):
|
def flag_done(request, comment_id):
|
||||||
|
@ -29,7 +30,7 @@ def flag_done(request, comment_id):
|
||||||
comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID)
|
comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID)
|
||||||
except comments.CommentDoesNotExist:
|
except comments.CommentDoesNotExist:
|
||||||
raise Http404
|
raise Http404
|
||||||
return render_to_response('comments/flag_done', {'comment': comment}, context_instance=DjangoContext(request))
|
return render_to_response('comments/flag_done', {'comment': comment}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
def delete(request, comment_id):
|
def delete(request, comment_id):
|
||||||
"""
|
"""
|
||||||
|
@ -54,7 +55,7 @@ def delete(request, comment_id):
|
||||||
m = moderatordeletions.ModeratorDeletion(None, request.user.id, comment.id, None)
|
m = moderatordeletions.ModeratorDeletion(None, request.user.id, comment.id, None)
|
||||||
m.save()
|
m.save()
|
||||||
return HttpResponseRedirect('%sdone/' % request.path)
|
return HttpResponseRedirect('%sdone/' % request.path)
|
||||||
return render_to_response('comments/delete_verify', {'comment': comment}, context_instance=DjangoContext(request))
|
return render_to_response('comments/delete_verify', {'comment': comment}, context_instance=RequestContext(request))
|
||||||
delete = login_required(delete)
|
delete = login_required(delete)
|
||||||
|
|
||||||
def delete_done(request, comment_id):
|
def delete_done(request, comment_id):
|
||||||
|
@ -62,4 +63,4 @@ def delete_done(request, comment_id):
|
||||||
comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID)
|
comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID)
|
||||||
except comments.CommentDoesNotExist:
|
except comments.CommentDoesNotExist:
|
||||||
raise Http404
|
raise Http404
|
||||||
return render_to_response('comments/delete_done', {'comment': comment}, context_instance=DjangoContext(request))
|
return render_to_response('comments/delete_done', {'comment': comment}, context_instance=RequestContext(request))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.contrib.flatpages.models import FlatPage
|
from django.contrib.flatpages.models import FlatPage
|
||||||
from django.template import loader
|
from django.template import loader, RequestContext
|
||||||
from django.core.extensions import get_object_or_404, DjangoContext
|
from django.core.extensions import get_object_or_404
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.conf.settings import SITE_ID
|
from django.conf.settings import SITE_ID
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def flatpage(request, url):
|
||||||
t = loader.select_template((f.template_name, DEFAULT_TEMPLATE))
|
t = loader.select_template((f.template_name, DEFAULT_TEMPLATE))
|
||||||
else:
|
else:
|
||||||
t = loader.get_template(DEFAULT_TEMPLATE)
|
t = loader.get_template(DEFAULT_TEMPLATE)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'flatpage': f,
|
'flatpage': f,
|
||||||
})
|
})
|
||||||
return HttpResponse(t.render(c))
|
return HttpResponse(t.render(c))
|
||||||
|
|
|
@ -4,7 +4,7 @@ template context. Each function takes the request object as its only parameter
|
||||||
and returns a dictionary to add to the context.
|
and returns a dictionary to add to the context.
|
||||||
|
|
||||||
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
||||||
DjangoContext.
|
RequestContext.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.settings import DEBUG, INTERNAL_IPS, LANGUAGES, LANGUAGE_CODE
|
from django.conf.settings import DEBUG, INTERNAL_IPS, LANGUAGES, LANGUAGE_CODE
|
||||||
|
|
|
@ -2,33 +2,9 @@
|
||||||
# of MVC. In other words, these functions/classes introduce controlled coupling
|
# of MVC. In other words, these functions/classes introduce controlled coupling
|
||||||
# for convenience's sake.
|
# for convenience's sake.
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.template import loader
|
||||||
from django.template import Context, loader
|
|
||||||
from django.conf.settings import TEMPLATE_CONTEXT_PROCESSORS
|
|
||||||
from django.http import HttpResponse, Http404
|
from django.http import HttpResponse, Http404
|
||||||
|
|
||||||
_standard_context_processors = None
|
|
||||||
|
|
||||||
# This is a function rather than module-level procedural code because we only
|
|
||||||
# want it to execute if somebody uses DjangoContext.
|
|
||||||
def get_standard_processors():
|
|
||||||
global _standard_context_processors
|
|
||||||
if _standard_context_processors is None:
|
|
||||||
processors = []
|
|
||||||
for path in TEMPLATE_CONTEXT_PROCESSORS:
|
|
||||||
i = path.rfind('.')
|
|
||||||
module, attr = path[:i], path[i+1:]
|
|
||||||
try:
|
|
||||||
mod = __import__(module, '', '', [attr])
|
|
||||||
except ImportError, e:
|
|
||||||
raise ImproperlyConfigured, 'Error importing request processor module %s: "%s"' % (module, e)
|
|
||||||
try:
|
|
||||||
func = getattr(mod, attr)
|
|
||||||
except AttributeError:
|
|
||||||
raise ImproperlyConfigured, 'Module "%s" does not define a "%s" callable request processor' % (module, attr)
|
|
||||||
processors.append(func)
|
|
||||||
_standard_context_processors = tuple(processors)
|
|
||||||
return _standard_context_processors
|
|
||||||
|
|
||||||
def render_to_response(*args, **kwargs):
|
def render_to_response(*args, **kwargs):
|
||||||
return HttpResponse(loader.render_to_string(*args, **kwargs))
|
return HttpResponse(loader.render_to_string(*args, **kwargs))
|
||||||
|
@ -46,22 +22,6 @@ def get_list_or_404(klass, **kwargs):
|
||||||
raise Http404
|
raise Http404
|
||||||
return obj_list
|
return obj_list
|
||||||
|
|
||||||
class DjangoContext(Context):
|
|
||||||
"""
|
|
||||||
This subclass of template.Context automatically populates itself using
|
|
||||||
the processors defined in TEMPLATE_CONTEXT_PROCESSORS.
|
|
||||||
Additional processors can be specified as a list of callables
|
|
||||||
using the "processors" keyword argument.
|
|
||||||
"""
|
|
||||||
def __init__(self, request, dict=None, processors=None):
|
|
||||||
Context.__init__(self, dict)
|
|
||||||
if processors is None:
|
|
||||||
processors = ()
|
|
||||||
else:
|
|
||||||
processors = tuple(processors)
|
|
||||||
for processor in get_standard_processors() + processors:
|
|
||||||
self.update(processor(request))
|
|
||||||
|
|
||||||
# PermWrapper and PermLookupDict proxy the permissions system into objects that
|
# PermWrapper and PermLookupDict proxy the permissions system into objects that
|
||||||
# the template system can understand.
|
# the template system can understand.
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,9 @@ from inspect import getargspec
|
||||||
from django.utils.functional import curry
|
from django.utils.functional import curry
|
||||||
from django.conf.settings import DEFAULT_CHARSET
|
from django.conf.settings import DEFAULT_CHARSET
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.template.context import Context, RequestContext
|
||||||
|
|
||||||
__all__ = ('Template','Context','compile_string')
|
__all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
|
||||||
|
|
||||||
TOKEN_TEXT = 0
|
TOKEN_TEXT = 0
|
||||||
TOKEN_VAR = 1
|
TOKEN_VAR = 1
|
||||||
|
@ -148,58 +149,6 @@ def compile_string(template_string, origin):
|
||||||
parser = parser_factory(lexer.tokenize())
|
parser = parser_factory(lexer.tokenize())
|
||||||
return parser.parse()
|
return parser.parse()
|
||||||
|
|
||||||
class Context:
|
|
||||||
"A stack container for variable context"
|
|
||||||
def __init__(self, dict=None):
|
|
||||||
dict = dict or {}
|
|
||||||
self.dicts = [dict]
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return repr(self.dicts)
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
for d in self.dicts:
|
|
||||||
yield d
|
|
||||||
|
|
||||||
def push(self):
|
|
||||||
self.dicts = [{}] + self.dicts
|
|
||||||
|
|
||||||
def pop(self):
|
|
||||||
if len(self.dicts) == 1:
|
|
||||||
raise ContextPopException
|
|
||||||
del self.dicts[0]
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
"Set a variable in the current context"
|
|
||||||
self.dicts[0][key] = value
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
"Get a variable's value, starting at the current context and going upward"
|
|
||||||
for dict in self.dicts:
|
|
||||||
if dict.has_key(key):
|
|
||||||
return dict[key]
|
|
||||||
return ''
|
|
||||||
|
|
||||||
def __delitem__(self, key):
|
|
||||||
"Delete a variable from the current context"
|
|
||||||
del self.dicts[0][key]
|
|
||||||
|
|
||||||
def has_key(self, key):
|
|
||||||
for dict in self.dicts:
|
|
||||||
if dict.has_key(key):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def get(self, key, otherwise):
|
|
||||||
for dict in self.dicts:
|
|
||||||
if dict.has_key(key):
|
|
||||||
return dict[key]
|
|
||||||
return otherwise
|
|
||||||
|
|
||||||
def update(self, other_dict):
|
|
||||||
"Like dict.update(). Pushes an entire dictionary's keys and values onto the context."
|
|
||||||
self.dicts = [other_dict] + self.dicts
|
|
||||||
|
|
||||||
class Token:
|
class Token:
|
||||||
def __init__(self, token_type, contents):
|
def __init__(self, token_type, contents):
|
||||||
"The token_type must be TOKEN_TEXT, TOKEN_VAR or TOKEN_BLOCK"
|
"The token_type must be TOKEN_TEXT, TOKEN_VAR or TOKEN_BLOCK"
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
from django.conf.settings import TEMPLATE_CONTEXT_PROCESSORS
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
|
_standard_context_processors = None
|
||||||
|
|
||||||
|
class Context:
|
||||||
|
"A stack container for variable context"
|
||||||
|
def __init__(self, dict=None):
|
||||||
|
dict = dict or {}
|
||||||
|
self.dicts = [dict]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return repr(self.dicts)
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
for d in self.dicts:
|
||||||
|
yield d
|
||||||
|
|
||||||
|
def push(self):
|
||||||
|
self.dicts = [{}] + self.dicts
|
||||||
|
|
||||||
|
def pop(self):
|
||||||
|
if len(self.dicts) == 1:
|
||||||
|
raise ContextPopException
|
||||||
|
del self.dicts[0]
|
||||||
|
|
||||||
|
def __setitem__(self, key, value):
|
||||||
|
"Set a variable in the current context"
|
||||||
|
self.dicts[0][key] = value
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
"Get a variable's value, starting at the current context and going upward"
|
||||||
|
for dict in self.dicts:
|
||||||
|
if dict.has_key(key):
|
||||||
|
return dict[key]
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def __delitem__(self, key):
|
||||||
|
"Delete a variable from the current context"
|
||||||
|
del self.dicts[0][key]
|
||||||
|
|
||||||
|
def has_key(self, key):
|
||||||
|
for dict in self.dicts:
|
||||||
|
if dict.has_key(key):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get(self, key, otherwise):
|
||||||
|
for dict in self.dicts:
|
||||||
|
if dict.has_key(key):
|
||||||
|
return dict[key]
|
||||||
|
return otherwise
|
||||||
|
|
||||||
|
def update(self, other_dict):
|
||||||
|
"Like dict.update(). Pushes an entire dictionary's keys and values onto the context."
|
||||||
|
self.dicts = [other_dict] + self.dicts
|
||||||
|
|
||||||
|
# This is a function rather than module-level procedural code because we only
|
||||||
|
# want it to execute if somebody uses RequestContext.
|
||||||
|
def get_standard_processors():
|
||||||
|
global _standard_context_processors
|
||||||
|
if _standard_context_processors is None:
|
||||||
|
processors = []
|
||||||
|
for path in TEMPLATE_CONTEXT_PROCESSORS:
|
||||||
|
i = path.rfind('.')
|
||||||
|
module, attr = path[:i], path[i+1:]
|
||||||
|
try:
|
||||||
|
mod = __import__(module, '', '', [attr])
|
||||||
|
except ImportError, e:
|
||||||
|
raise ImproperlyConfigured, 'Error importing request processor module %s: "%s"' % (module, e)
|
||||||
|
try:
|
||||||
|
func = getattr(mod, attr)
|
||||||
|
except AttributeError:
|
||||||
|
raise ImproperlyConfigured, 'Module "%s" does not define a "%s" callable request processor' % (module, attr)
|
||||||
|
processors.append(func)
|
||||||
|
_standard_context_processors = tuple(processors)
|
||||||
|
return _standard_context_processors
|
||||||
|
|
||||||
|
class RequestContext(Context):
|
||||||
|
"""
|
||||||
|
This subclass of template.Context automatically populates itself using
|
||||||
|
the processors defined in TEMPLATE_CONTEXT_PROCESSORS.
|
||||||
|
Additional processors can be specified as a list of callables
|
||||||
|
using the "processors" keyword argument.
|
||||||
|
"""
|
||||||
|
def __init__(self, request, dict=None, processors=None):
|
||||||
|
Context.__init__(self, dict)
|
||||||
|
if processors is None:
|
||||||
|
processors = ()
|
||||||
|
else:
|
||||||
|
processors = tuple(processors)
|
||||||
|
for processor in get_standard_processors() + processors:
|
||||||
|
self.update(processor(request))
|
|
@ -1,6 +1,7 @@
|
||||||
from django.parts.auth.formfields import AuthenticationForm
|
from django.parts.auth.formfields import AuthenticationForm
|
||||||
from django.core import formfields
|
from django.core import formfields
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
from django.contrib.auth.models import SESSION_KEY
|
from django.contrib.auth.models import SESSION_KEY
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
|
@ -28,14 +29,14 @@ def login(request):
|
||||||
'form': formfields.FormWrapper(manipulator, request.POST, errors),
|
'form': formfields.FormWrapper(manipulator, request.POST, errors),
|
||||||
REDIRECT_FIELD_NAME: redirect_to,
|
REDIRECT_FIELD_NAME: redirect_to,
|
||||||
'site_name': Site.objects.get_current().name,
|
'site_name': Site.objects.get_current().name,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
def logout(request, next_page=None):
|
def logout(request, next_page=None):
|
||||||
"Logs out the user and displays 'You are logged out' message."
|
"Logs out the user and displays 'You are logged out' message."
|
||||||
try:
|
try:
|
||||||
del request.session[SESSION_KEY]
|
del request.session[SESSION_KEY]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return render_to_response('registration/logged_out', context_instance=DjangoContext(request))
|
return render_to_response('registration/logged_out', context_instance=RequestContext(request))
|
||||||
else:
|
else:
|
||||||
# Redirect to this page until the session has been cleared.
|
# Redirect to this page until the session has been cleared.
|
||||||
return HttpResponseRedirect(next_page or request.path)
|
return HttpResponseRedirect(next_page or request.path)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.core.xheaders import populate_xheaders
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.core import formfields, meta
|
from django.core import formfields, meta
|
||||||
from django.views.auth.login import redirect_to_login
|
from django.views.auth.login import redirect_to_login
|
||||||
from django.core.extensions import DjangoContext
|
from django.template import RequestContext
|
||||||
from django.core.paginator import ObjectPaginator, InvalidPage
|
from django.core.paginator import ObjectPaginator, InvalidPage
|
||||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||||
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
|
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
|
||||||
|
@ -60,7 +60,7 @@ def create_object(request, app_label, module_name, template_name=None,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_form" % (app_label, module_name)
|
template_name = "%s/%s_form" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'form': form,
|
'form': form,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
for key, value in extra_context.items():
|
for key, value in extra_context.items():
|
||||||
|
@ -131,7 +131,7 @@ def update_object(request, app_label, module_name, object_id=None, slug=None,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_form" % (app_label, module_name)
|
template_name = "%s/%s_form" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'form': form,
|
'form': form,
|
||||||
'object': object,
|
'object': object,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
|
@ -188,7 +188,7 @@ def delete_object(request, app_label, module_name, post_delete_redirect,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_confirm_delete" % (app_label, module_name)
|
template_name = "%s/%s_confirm_delete" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object': object,
|
'object': object,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
for key, value in extra_context.items():
|
for key, value in extra_context.items():
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from django.template import loader
|
from django.template import loader, RequestContext
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.core.extensions import DjangoContext
|
|
||||||
from django.core.xheaders import populate_xheaders
|
from django.core.xheaders import populate_xheaders
|
||||||
from django.models import get_module
|
from django.models import get_module
|
||||||
from django.http import Http404, HttpResponse
|
from django.http import Http404, HttpResponse
|
||||||
|
@ -38,7 +37,7 @@ def archive_index(request, app_label, module_name, date_field, num_latest=15,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_archive" % (app_label, module_name)
|
template_name = "%s/%s_archive" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'date_list' : date_list,
|
'date_list' : date_list,
|
||||||
'latest' : latest,
|
'latest' : latest,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
|
@ -75,7 +74,7 @@ def archive_year(request, year, app_label, module_name, date_field,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_archive_year" % (app_label, module_name)
|
template_name = "%s/%s_archive_year" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'date_list': date_list,
|
'date_list': date_list,
|
||||||
'year': year,
|
'year': year,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
|
@ -123,7 +122,7 @@ def archive_month(request, year, month, app_label, module_name, date_field,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_archive_month" % (app_label, module_name)
|
template_name = "%s/%s_archive_month" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object_list': object_list,
|
'object_list': object_list,
|
||||||
'month': date,
|
'month': date,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
|
@ -172,7 +171,7 @@ def archive_day(request, year, month, day, app_label, module_name, date_field,
|
||||||
if not template_name:
|
if not template_name:
|
||||||
template_name = "%s/%s_archive_day" % (app_label, module_name)
|
template_name = "%s/%s_archive_day" % (app_label, module_name)
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object_list': object_list,
|
'object_list': object_list,
|
||||||
'day': date,
|
'day': date,
|
||||||
'previous_day': date - datetime.timedelta(days=1),
|
'previous_day': date - datetime.timedelta(days=1),
|
||||||
|
@ -241,7 +240,7 @@ def object_detail(request, year, month, day, app_label, module_name, date_field,
|
||||||
t = template_loader.select_template(template_name_list)
|
t = template_loader.select_template(template_name_list)
|
||||||
else:
|
else:
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object': object,
|
'object': object,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
for key, value in extra_context.items():
|
for key, value in extra_context.items():
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
from django import models
|
from django import models
|
||||||
from django.template import loader
|
from django.template import loader, RequestContext
|
||||||
from django.http import Http404, HttpResponse
|
from django.http import Http404, HttpResponse
|
||||||
from django.core.xheaders import populate_xheaders
|
from django.core.xheaders import populate_xheaders
|
||||||
from django.core.extensions import DjangoContext
|
|
||||||
from django.core.paginator import ObjectPaginator, InvalidPage
|
from django.core.paginator import ObjectPaginator, InvalidPage
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ def object_list(request, app_label, module_name, paginate_by=None, allow_empty=F
|
||||||
else:
|
else:
|
||||||
raise Http404
|
raise Http404
|
||||||
page = int(page)
|
page = int(page)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object_list': object_list,
|
'object_list': object_list,
|
||||||
'is_paginated': paginator.pages > 1,
|
'is_paginated': paginator.pages > 1,
|
||||||
'results_per_page': paginate_by,
|
'results_per_page': paginate_by,
|
||||||
|
@ -62,7 +61,7 @@ def object_list(request, app_label, module_name, paginate_by=None, allow_empty=F
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
else:
|
else:
|
||||||
object_list = mod.get_list(**lookup_kwargs)
|
object_list = mod.get_list(**lookup_kwargs)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object_list': object_list,
|
'object_list': object_list,
|
||||||
'is_paginated': False
|
'is_paginated': False
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
|
@ -110,7 +109,7 @@ def object_detail(request, app_label, module_name, object_id=None, slug=None,
|
||||||
t = template_loader.select_template(template_name_list)
|
t = template_loader.select_template(template_name_list)
|
||||||
else:
|
else:
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = DjangoContext(request, {
|
c = RequestContext(request, {
|
||||||
'object': object,
|
'object': object,
|
||||||
}, context_processors)
|
}, context_processors)
|
||||||
for key, value in extra_context.items():
|
for key, value in extra_context.items():
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
|
from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
|
||||||
|
|
||||||
def direct_to_template(request, template, **kwargs):
|
def direct_to_template(request, template, **kwargs):
|
||||||
|
@ -6,7 +7,7 @@ def direct_to_template(request, template, **kwargs):
|
||||||
Render a given template with any extra URL parameters in the context as
|
Render a given template with any extra URL parameters in the context as
|
||||||
``{{ params }}``.
|
``{{ params }}``.
|
||||||
"""
|
"""
|
||||||
return render_to_response(template, {'params' : kwargs}, context_instance=DjangoContext(request))
|
return render_to_response(template, {'params' : kwargs}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
def redirect_to(request, url, **kwargs):
|
def redirect_to(request, url, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.core import formfields, validators
|
from django.core import formfields, validators
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import render_to_response
|
||||||
from django.template import Context, loader
|
from django.template import Context, RequestContext, loader
|
||||||
from django.models.auth import User
|
from django.models.auth import User
|
||||||
from django.models.core import Site
|
from django.models.core import Site
|
||||||
from django.views.decorators.auth import login_required
|
from django.views.decorators.auth import login_required
|
||||||
|
@ -78,10 +78,10 @@ def password_reset(request, is_admin_site=False):
|
||||||
form.save()
|
form.save()
|
||||||
return HttpResponseRedirect('%sdone/' % request.path)
|
return HttpResponseRedirect('%sdone/' % request.path)
|
||||||
return render_to_response('registration/password_reset_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
return render_to_response('registration/password_reset_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
||||||
context_instance=DjangoContext(request))
|
context_instance=RequestContext(request))
|
||||||
|
|
||||||
def password_reset_done(request):
|
def password_reset_done(request):
|
||||||
return render_to_response('registration/password_reset_done', context_instance=DjangoContext(request))
|
return render_to_response('registration/password_reset_done', context_instance=RequestContext(request))
|
||||||
|
|
||||||
def password_change(request):
|
def password_change(request):
|
||||||
new_data, errors = {}, {}
|
new_data, errors = {}, {}
|
||||||
|
@ -93,8 +93,8 @@ def password_change(request):
|
||||||
form.save(new_data)
|
form.save(new_data)
|
||||||
return HttpResponseRedirect('%sdone/' % request.path)
|
return HttpResponseRedirect('%sdone/' % request.path)
|
||||||
return render_to_response('registration/password_change_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
return render_to_response('registration/password_change_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
||||||
context_instance=DjangoContext(request))
|
context_instance=RequestContext(request))
|
||||||
password_change = login_required(password_change)
|
password_change = login_required(password_change)
|
||||||
|
|
||||||
def password_change_done(request):
|
def password_change_done(request):
|
||||||
return render_to_response('registration/password_change_done', context_instance=DjangoContext(request))
|
return render_to_response('registration/password_change_done', context_instance=RequestContext(request))
|
||||||
|
|
Loading…
Reference in New Issue