Monday, October 25, 2010

Django-Cms Installation error "PageAdmin.exclude' refers to field 'created_by' that is missing from"


Error :
Error "ImproperlyConfigured at / 'PageAdmin.exclude' refers to field 'created_by' that is 
missing from the form" 
Problem Solve :
Fixed this error 
by just setting editable=False on created_by and changed_by and removing all fields from 
PageAdmin.exclude (the other fields already were editable=False)
Edit two files to fix this error
 
Edit file: cms/admin/pageadmin.py
Line no. 65 approximately. 
 revision_form_template = "admin/cms/page/revision_form.html"
Change this line
-    exclude = ['created_by', 'changed_by', 'lft', 'rght', 
'tree_id', 'level']
by 
+  exclude = []  
 mandatory_placeholders = ('title', 'slug', 'parent', 'site',  
'meta_description', 'meta_keywords', 'page_title', 'menu_title') 
top_fields = [] 
 general_fields = ['title', 'slug', ('published', 'in_navigation')]
     
Edit File : cms/admin/pagemodel.py
line no. 40 approximately 
template_choices = [(x, _(y)) for x,y in settings.CMS_TEMPLATES]
change following lines 
-   created_by = models.CharField(_("created by"), max_length=70)
-    changed_by = models.CharField(_("changed by"), max_length=70)
by 
+    created_by = models.CharField(_("created by"), 
max_length=70, editable=False)
+    changed_by = models.CharField(_("changed by"),
 max_length=70, editable=False)
     parent = models.ForeignKey('self', null=True, blank=True,
 related_name='children', db_index=True)
     creation_date = models.DateTimeField(editable=False,
 default=datetime.now)
 


No comments:

Post a Comment