-
Notifications
You must be signed in to change notification settings - Fork 709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError u'parent' at mptt\forms.py in __init__, line 165 #140
Comments
Which version of MPTT are you using? |
mptt version 0.6.0 |
Fix available in latest v0.2.4 |
Please, help me! I have issue as your - tom200808. How you fixed up its? |
@shenzia Have you updated to latest django-suit version v0.2.5 and latest django-mptt app? |
django-suit==0.2.4 |
@shenzia latest is not v0.2.4 but v0.2.5
|
I done --upgrade, but issue didn't disappeared.. |
models.py class Contacts(MPTTModel):
name = models.CharField(u"Имя отправителя", max_length=64, blank=True, null=True)
email = models.EmailField(u"Email", max_length=75, blank=True, null=True)
adress = models.CharField(u"Адрес отправителя", max_length=150, blank=True, null=True)
site = models.ForeignKey(Site, verbose_name='Сайты', blank = True, default=True)
objects = models.Manager()
on_site = CurrentSiteManager()
username = models.ForeignKey(User, default = True)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
def __unicode__(self):
return u'%s' % str(self.name)
class MPTTMeta:
verbose_name = u"Контакт"
verbose_name_plural = u"Контакты"
order_insertion_by = ['name']
permissions = (
('view_contacts', 'View contacts'),
) admins.py class ContactsAdmin(MPTTModelAdmin, TranslationAdmin):
list_display = ('name', 'email', 'adress',)
list_display_links = ('name', 'email',)
list_filter = (ContactsFilter,)
ordering = ('name',)
fieldsets = [
('Contacts', {'fields': ['name', 'email', 'adress']}),
('Email information', {'fields': ['site', 'username'], 'classes':['collapse']}),
]
class Media:
js = (
'/static/modeltranslation/js/force_jquery.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js',
'/static/modeltranslation/js/tabbed_translation_fields.js',
)
css = {
'screen': ('/static/modeltranslation/css/tabbed_translation_fields.css',),
}
admin.site.register(Contacts, ContactsAdmin) |
@shenzia please post also full error stack (use dpaste.com link from Django error view) |
thanks for your help, but i remove MPTTModelAdmin. But have a new problem. Doesn't display tabs in admin. I used doc https://django-modeltranslation.readthedocs.org/en/0.6/admin.html#using-tabbed-translation-fields and https://github.com/jmagnusson/grappelli-modeltranslation. admin.py
models.py
settings.py here is all the languages supported by the CMSPAGE_LANGUAGES = ( copy PAGE_LANGUAGESlanguages = list(PAGE_LANGUAGES) redefine the LANGUAGES setting in order to be sure to have the correct request.LANGUAGE_CODELANGUAGES = languages INSTALLED_APPS = ( Please help me again.. |
in the admin.py, it NOT work:
but work when remove MPTTModelAdmin or SortableModelAdmin, as follow:
or
Error message :
KeyError at /admin/edition/category/
u'parent'
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/edition/category/
Django Version: 1.5.1
Exception Type: KeyError
Exception Value:
u'parent'
Exception Location: E:\myenv\lib\site-packages\mptt\forms.py in init, line 165
Python Executable: E:\myenv\Scripts\python.exe
Python Version: 2.7.4
Python Path:
['E:\myenv\EDMIS3',
'E:\myenv\EDMIS3',
'C:\Windows\system32\python27.zip',
'E:\myenv\DLLs',
'E:\myenv\lib',
'E:\myenv\lib\plat-win',
'E:\myenv\lib\lib-tk',
'E:\myenv\Scripts',
'D:\dev\python\Lib',
'D:\dev\python\DLLs',
'D:\dev\python\Lib\lib-tk',
'E:\myenv',
'E:\myenv\lib\site-packages']
Server time: 星期二, 13 八月 2013 11:03:28 +0800
source code:
models.py
admin.py
The text was updated successfully, but these errors were encountered: