Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form CommitmentForm needs updating

5,085 views
Skip to first unread message

Francis Louis

unread,
Aug 24, 2015, 3:18:32 AM8/24/15
to Django users
Hi All,

May I ask this question,

I am using Django 1.8.4 with Python 2.7

After I run the development server by running this command c:\Python27\python.exe manage.py runserver and access the below given URL,


I get this error, May I know how to resolve this issue?

Best Regards
Francis

ImproperlyConfigured at /

Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form CommitmentForm needs updating.
Request Method:GET
Request URL:http://127.0.0.1:8000/
Django Version:1.8.4
Exception Type:ImproperlyConfigured
Exception Value:
Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form CommitmentForm needs updating.
Exception Location:c:\Python27\lib\site-packages\django\forms\models.py in __new__, line 274
Python Executable:c:\Python27\python.exe
Python Version:2.7.10
Python Path:
['c:\\data1\\SocialGame\\sg',
 'C:\\windows\\SYSTEM32\\python27.zip',
 'c:\\Python27\\DLLs',
 'c:\\Python27\\lib',
 'c:\\Python27\\lib\\plat-win',
 'c:\\Python27\\lib\\lib-tk',
 'c:\\Python27',
 'c:\\Python27\\lib\\site-packages',
 'c:\\data1\\SocialGame\\sg',
 'c:\\data1\\SocialGame\\sg\\SocialGame\\../..',
 'c:\\data1\\SocialGame\\sg']
Server time:Mon, 24 Aug 2015 15:03:37 +0800

James Schneider

unread,
Aug 24, 2015, 4:49:28 AM8/24/15
to django...@googlegroups.com
You need to set the fields attribute in the Meta class of your ModelForm:


Or, if you are not using a custom ModelForm (Django is building it for you dynamically), then you need to specify the fields on your view:


-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/28ad1260-55f4-4eb2-af6c-5daee988e0ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roberth Solis Martínez

unread,
Sep 12, 2015, 8:18:59 PM9/12/15
to Django users
from django import forms
from .models import myModel

class ModelForm(forms.ModelForm):

    class Meta:
        model = myModel 
        fields = '__all__'
Reply all
Reply to author
Forward
0 new messages