##// END OF EJS Templates
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules

File last commit:

r566:f1e34d4b 1.7-dev
r690:a8dffe47 1.8-dev
Show More
mixins.py
39 lines | 1.1 KiB | text/x-python | PythonLexer
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 PARAMETER_METHOD = 'method'
from django.shortcuts import redirect
from django.http import HttpResponseRedirect
class RedirectNextMixin:
def redirect_to_next(self, request):
"""
If a 'next' parameter was specified, redirect to the next page. This
is used when the user is required to return to some page after the
current view has finished its work.
"""
if 'next' in request.GET:
next_page = request.GET['next']
return HttpResponseRedirect(next_page)
else:
return redirect('index')
class DispatcherMixin:
"""
This class contains a dispather method that can run a method specified by
'method' request parameter.
"""
neko259
Added post admin page with tags edit capability
r566 def dispatch_method(self, *args, **kwargs):
request = args[0]
method_name = None
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 if PARAMETER_METHOD in request.GET:
method_name = request.GET[PARAMETER_METHOD]
neko259
Added post admin page with tags edit capability
r566 elif PARAMETER_METHOD in request.POST:
method_name = request.POST[PARAMETER_METHOD]
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563
neko259
Added post admin page with tags edit capability
r566 if method_name:
return getattr(self, method_name)(*args, **kwargs)