ChangeObjectDialog unbound method get_verbose_name() must be called with Admin instance as first argument (got nothing instead)

27 views
Skip to first unread message

Juan Diego Bracamonte

unread,
Sep 14, 2019, 5:03:35 AM9/14/19
to Project Camelot
Hello. I'm trying to use ChangeObjectDialog class and I have an error...

I have a simple class
class Parametro(Entity):
    using_options(tablename = 'parametro')

    nombre = Field(Unicode(64), required=True, unique=True)
    valor = Field(Text)
    descripcion = Field(Unicode(255))

    def __unicode__(self):
        return unicode(self.nombre)

    @property
    def note(self):
        pass

    class Admin(EntityAdmin):
        verbose_name = 'Parametro'
        verbose_name_plural  = 'Parametros'
        list_display  = ['nombre', 'valor', 'descripcion']
        list_search = ['nombre']
        confirm_delete = True
        
        form_display  = GroupBoxForm('', ['nombre', 'descripcion', 'valor'])
        form_display = VBoxForm([WidgetOnlyForm('note'), form_display])

        list_filter = [EditorFilter('nombre', 'Parametro', like_op)]

        form_actions = [actions.action_steps.ModificarParametros()]
        
        field_attributes = dict(note = {'delegate':delegates.NoteDelegate}, 
                                nombre = {'minimal_column_width':40},
                                valor = {'minimal_column_width':50, 'delegate':delegates.TextEditDelegate, 'editable': True},
                                descripcion = {'minimal_column_width':80},
                                )

In an Action I want to execute this code

class ModificarParametros(Action):
    verbose_name = u"Modificar Parametros"
    tooltip = u"Crear Contacto"
    perm_required = ["administrativo"]
                        
    def model_run( self, model_context ):
        
        parametro = model_context.get_object()
        
        obj = yield ChangeObjectDialog(parametro, parametro.Admin)


Error...

  File "C:\python27\lib\site-packages\camelot\view\action_steps\change_object.py", line 65, in __init__
    self.setWindowTitle( admin.get_verbose_name() )
TypeError: unbound method get_verbose_name() must be called with Admin instance as first argument (got nothing instead)

Can you help me?

Thanks! 


Reply all
Reply to author
Forward
0 new messages