@Mistadrumma

Ошибка в DjangoAdmin c виджетом TinyMCE. Кто нибудь знает как пофиксить?

Всем привет! Кто нибудь знает как пофиксить? Ошибка в DjangoAdmin c виджетом TinyMCE.
Ругается на аргумент profile.
Django Version: 1.9.4
Python Version: 2.7.7
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'castshop',
 'tinymce']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  541.                 return self.admin_site.admin_view(view)(*args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  244.             return view(request, *args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/contrib/admin/options.py" in add_view
  1437.         return self.changeform_view(request, None, form_url, extra_context)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  184.                     return func(*args, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/contrib/admin/options.py" in changeform_view
  1367.         ModelForm = self.get_form(request, obj)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/contrib/admin/options.py" in get_form
  639.             return modelform_factory(self.model, **defaults)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/forms/models.py" in modelform_factory
  545.     return type(form)(class_name, (form,), form_class_attrs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/forms/models.py" in __new__
  247.                                       opts.field_classes)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/forms/models.py" in fields_for_model
  176.             formfield = formfield_callback(f, **kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/contrib/admin/options.py" in formfield_for_dbfield
  173.                 return db_field.formfield(**kwargs)

File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/tinymce/models.py" in formfield
  31.                 profile=self.tinymce_profile)

Exception Type: TypeError at /admin/castshop/articles/add/
Exception Value: __init__() got an unexpected keyword argument 'profile'

Я так понял профайл это сам конфиг tinymce.
/home/c/chzat/.djangovenv/lib/python2.7/site-packages/tinymce/models.py in formfield
            'widget': tinymce_widgets.TinyMCE(profile=self.tinymce_profile)
        }
        defaults.update(kwargs)
        # As an ugly hack, we override the admin widget
        if defaults['widget'] == admin_widgets.AdminTextareaWidget:
            defaults['widget'] = tinymce_widgets.AdminTinyMCE(
          profile=self.tinymce_profile) 
        return super(HTMLField, self).formfield(**defaults)


Когда использую виджет для администратора через модель, вот модель
class Articles (models.Model):
    class Meta:
        db_table = 'articles'
        ordering = ['-article_date']
    STATUS_CHOICES = (
    ('d', 'Черновик'),
    ('p', 'Опублиованно'),
    ('w', 'Снято'),

)
    article_title = models.CharField(max_length=200, verbose_name='Заголовок')
    article_slug = models.SlugField(default='')
    article_text = HTMLField(verbose_name='Содержание')
    article_user = models.ForeignKey(User, verbose_name='Автор')
    article_date = models.DateTimeField(verbose_name='Дата поста')
    article_like = models.IntegerField(default=0)
    article_status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='d', verbose_name='Статус')
    article_published = models.CharField(max_length=50, default= u'Не один пользователь не опублиовал статью', verbose_name='Опубликовал')
    article_status_ok = models.BooleanField(default=False, verbose_name='В сети')
    article_category = models.ManyToManyField(Category, default='', verbose_name='Категория')
    article_tag = models.ManyToManyField(Tag, default='', verbose_name='Теги')
    def _unicode_(self):
        return self.name
  • Вопрос задан
  • 266 просмотров
Решения вопроса 1
sergey-gornostaev
@sergey-gornostaev Куратор тега Django
Седой и строгий
Это известный баг. Нужен именно django-tinymce4? django-tinymce не подойдёт?
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
zelsky
@zelsky
юзай django-ckeditor
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы