##// END OF EJS Templates
Made some fields in post admin read-only. Show attachment as its url
Made some fields in post admin read-only. Show attachment as its url

File last commit:

r1366:daa35cca default
r1389:c9a1cd47 default
Show More
mixins.py
26 lines | 678 B | text/x-python | PythonLexer
PARAM_NEXT = 'next'
PARAMETER_METHOD = 'method'
class DispatcherMixin:
"""
This class contains a dispather method that can run a method specified by
'method' request parameter.
"""
def __init__(self):
self.user = None
def dispatch_method(self, *args, **kwargs):
request = args[0]
self.user = request.user
method_name = None
if PARAMETER_METHOD in request.GET:
method_name = request.GET[PARAMETER_METHOD]
elif PARAMETER_METHOD in request.POST:
method_name = request.POST[PARAMETER_METHOD]
if method_name:
return getattr(self, method_name)(*args, **kwargs)