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

Django 1.11 #970

Merged
merged 2 commits into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions network-api/networkapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@

'mezzanine.core.request.CurrentRequestMiddleware',
'mezzanine.core.middleware.RedirectFallbackMiddleware',
'mezzanine.core.middleware.TemplateForDeviceMiddleware',
'mezzanine.core.middleware.TemplateForHostMiddleware',
'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
'mezzanine.core.middleware.SitePermissionMiddleware',
'mezzanine.pages.middleware.PageMiddleware',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ def render_sortable_objects(
objects,
sortable_objects_template='adminsortable/shared/objects.html'
):
context.update({'objects': objects})
tmpl = template.loader.get_template(sortable_objects_template)
return tmpl.render(context)
return tmpl.render({
'objects': objects,
'opts': context.get('opts'),
})


@register.simple_tag(takes_context=True)
Expand All @@ -22,9 +24,12 @@ def render_nested_sortable_objects(
group_expression,
sortable_nested_objects_template='adminsortable/shared/nested_objects.html'
):
context.update({'objects': objects, 'group_expression': group_expression})
tmpl = template.loader.get_template(sortable_nested_objects_template)
return tmpl.render(context)
return tmpl.render({
'objects': objects,
'group_expression': group_expression,
'opts': context.get('opts'),
})


@register.simple_tag(takes_context=True)
Expand All @@ -33,9 +38,11 @@ def render_list_items(
list_objects,
sortable_list_items_template='adminsortable/shared/list_items.html'
):
context.update({'list_objects': list_objects})
tmpl = template.loader.get_template(sortable_list_items_template)
return tmpl.render(context)
return tmpl.render({
'list_objects': list_objects,
'opts': context.get('opts'),
})


@register.simple_tag(takes_context=True, name='render_object_rep')
Expand All @@ -44,10 +51,13 @@ def render_object_rep(
obj,
forloop
):
context.update({'object': obj, 'forloop': forloop})
tmpl = template.loader.get_template(
'{app_name}/adminsortable_objects_custom.html'.format(
app_name=context.get('opts').app_label
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still working?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trick was to pass opts along from context in every level of the template render, since it only accepts a plain dict.

)
)
return tmpl.render(context)
return tmpl.render({
'object': obj,
'forloop': forloop,
'opts': context.get('opts'),
})
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Core
Django==1.10.8
Django==1.11
gunicorn==19.6.0
djangorestframework==3.5.4
django-filter==1.0.2

# Mezzanine CMS
Mezzanine==4.2.3
# Mezzanine CMS - Use version with Django 1.11 LTS support
git+https://github.com/stephenmcd/mezzanine@521a98c39bb6351c4b46067069f33caf95fe0a5e#egg=Mezzanine
filebrowser_s3==1.0.0

# social auth is useful
Expand Down Expand Up @@ -37,7 +37,7 @@ django-cors-headers==2.0.2
django-csp==3.3

# Admin sort models
django-admin-sortable==2.1.0
django-admin-sortable==2.1.2

# HTTP requests
requests==2.13.0
Expand Down