Skip to content

Commit

Permalink
More changes needed for Django 1.11 (having to do with forms not havi…
Browse files Browse the repository at this point in the history
…ng 'fields' or 'exclude' in Meta

and using render_to_response() instead of the new render())
  • Loading branch information
adamestein committed Jan 19, 2018
1 parent f0b77be commit 25d8c54
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tekextensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = (0, 0, 6)
VERSION = (0, 0, 7)
__version__ = '.'.join(map(str, VERSION))
2 changes: 1 addition & 1 deletion tekextensions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def normalize_model_name(model_name):
def get_model_form(model_name):
for model in apps.get_models():
if model.__name__ == model_name:
return modelform_factory(model)
return modelform_factory(model, exclude=[])

raise Exception('Did not find the model %s' % model_name)

4 changes: 2 additions & 2 deletions tekextensions/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.forms import ValidationError
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.shortcuts import render
from django.template import RequestContext
from django.utils.html import escape

Expand Down Expand Up @@ -30,5 +30,5 @@ def add_new_model(request, model_name, form=None, template='popup.html'):
form = form()

page_context = {'form': form, 'field': normal_model_name}
return render_to_response(template, page_context, context_instance=RequestContext(request))
return render(request, template, page_context)

0 comments on commit 25d8c54

Please sign in to comment.