Fixed all important deprecation warnings for Django 3.0
Another warning about obsoleted `context` parameter in `from_db_value()`
is a valse positive, because aour parameter is optional, made for a new
3.0 and also for an old Django.
@@ -17,9 +17,8 @@ log = logging.getLogger(__name__)
def list_accounts(request):
accounts = models.Account.objects.all()[0:5]
- return shortcuts.render_to_response('list-accounts.html',
- dict(title="List First 5 Accounts",
- accounts=accounts,)
+ return shortcuts.render(request, 'list-accounts.html',
+ dict(title="List First 5 Accounts", accounts=accounts)
)
@@ -32,8 +31,6 @@ def search_accounts(request):
else:
form = forms.SearchForm()
- return shortcuts.render_to_response('search-accounts.html',
- dict(title="Search Accounts by Email",
- accounts=accounts,
- form=form,)
+ return shortcuts.render(request, 'search-accounts.html',
+ dict(title="Search Accounts by Email", accounts=accounts, form=form)
)
