V
V
Vitaly2015-10-02 20:50:44
Django
Vitaly, 2015-10-02 20:50:44

How can I restore the Djando CMS plugin to work?

Hello, I decided to make a plug-in for Djando CMS the first time everything worked out fine, but after a while (I don’t remember what I did) it stopped working, and it works when I delete the model = Slider field

# _*_ coding: utf-8 _*_
__author__ = 'vitali'
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from .models import Slider


class SliderPlugin(CMSPluginBase):
    module = _("Our Mega Plugins")
    name = _("Slider Plugin")
    render_template = "plugin/plugin.html"
   # model = Slider

    def render(self, context, instance, placeholder):
        context.update({'instance': instance})
        return context

plugin_pool.register_plugin(SliderPlugin)

model
class Slider (CMSPlugin):  # Класс созданный для управления плагином
    user_num = models.IntegerField(default=10)

    def __unicode__(self):
        return self.user_num

When the model is connected, I see the following
c8dad4ea44294ce992443fbd16279024.png
Entering data (there is only one digit) is useless, it is not saved
What I did:
1) re-created the application from scratch
2) changed it to the setting. ru DB

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2015-10-02
@allposts_vitali

Everything was decided archi simply
Namely:
Instead of

def __unicode__(self):
        return self.user_num

need to use
def __str__(self):
        return u'%s' % self.title

Or use 3rd python

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question