Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'str' object has no attribute 'META' error while creating a ModelForm in django

Tags:

django-forms

I'm trying to create a ModelForm with the following code snippet. I get this error "'str' object has no attribute 'META'". Why is that? Thanks

In my_app/forms.py

from django.contrib.auth.models import User
from django.forms import ModelForm
class UserProfileForm(ModelForm):
      class Meta:
            model = User

In may_app/views.py

def u(request):
    form = UserProfileForm()
    return render('/projects/templates/form.html',{'form':form})
like image 896
ggss Avatar asked Jul 18 '11 22:07

ggss


1 Answers

def u(request):
    form = UserProfileForm()
    return render(request,'/projects/templates/form.html',{'form':form})
like image 93
Asinox Avatar answered Sep 28 '22 17:09

Asinox