0
In my views, Django 1.10, I have the code:
from django.shortcuts import *
from appcrud.forms import *
def inicial(request):
if request.method == "POST":
form = FormCrud(request.POST)
if form.is_valid():
form.save()
else:
form = FormCrud()
return render(request, "index.html", {"form": form})
The Forms:
from django import forms
from appcrud.models import *
class FormCrud(forms.Form):
name = forms.CharField(max_length = 150)
profissao = forms.CharField(max_length=150)
and the model:
from __future__ import unicode_literals
from django.db import models
from mongoengine import *
class Cruds(Document):
name = StringField(max_length=150,required=True)
profissao = StringField(max_length=150)
The server works normally but this error appears in the return :
__init__() got an unexpected keyword argument 'current_app'
Request Method: GET
Request URL: http://localhost:8000/inicio/
Django Version: 1.10.3
Exception Type: TypeError
Exception Value:
__init__() got an unexpected keyword argument 'current_app'
Exception Location: C:\Anaconda2\lib\site-packages\django\shortcuts\__init__.py in render, line 49
I am configuring the project to use mongodb, they would know me answer?
Grateful for the attention!
It seems that Django 1.10 is not installed correctly, because the render does not even have this argument anymore
current_app
in that version. My suggestion is to uninstall Django, and install again:pip uninstall -y Django
pip install Django --no-cache-dir
– mazulo
Thanks, I did it and it worked!
– Carlos Andre
I will play the text of the comment as an answer, to be documented to the guys who in the future bump into the same problem :)
– mazulo