You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
503 B
16 lines
503 B
from django.template.context import RequestContext
|
|
|
|
|
|
def get_context_dict(context):
|
|
"""
|
|
Contexts in django version 1.9+ must be dictionaries. As xadmin has a legacy with older versions of django,
|
|
the function helps the transition by converting the [RequestContext] object to the dictionary when necessary.
|
|
:param context: RequestContext
|
|
:return: dict
|
|
"""
|
|
if isinstance(context, RequestContext):
|
|
ctx = context.flatten()
|
|
else:
|
|
ctx = context
|
|
return ctx
|