TreeEditor shows (None) for items in admin changelist (feincms example Categories)

42 views
Skip to first unread message

NicoEchániz

unread,
Feb 15, 2010, 9:31:55 AM2/15/10
to Django FeinCMS
Hi,

I've been trying to use feincms TreeEditor for some mptt registered
models of mine but I get a bad changelist for the admin.
The editor still sort of works, but displays (None) for every row in
the changelist.

At first I thought I was doinig something wrong but then I tried the
example in feincms and found out that the editor works fine for Pages
but has the same problem my models have when editing Categories.

I followed this steps:
http://magicrebirth.wordpress.com/2009/08/18/django-admin-and-mptt-2/#comment-140

And I also compared my setup with the feincms Category example and
they are the same.

Versions I am using:
Django – 1.2-beta-1 – active (rev.12437)
FeinCMS – 1.0.4 – active development
django-mptt – 0.3-pre – active development (rev.121)

Any hints on what may be causing this?

Thanx,

NicoEchániz

NicoEchániz

unread,
Feb 15, 2010, 12:28:43 PM2/15/10
to Django FeinCMS
Ok,

Looks like this (None) was coming from not having a get_absolute_url()
method defined in my model.

TreeEditor.__init__ () adds 'indented_short_title' to the admin
list_display and this indented_short_title method calls a
get_absolute_url() method from your model which is not present unless
you define it.

this commit introduced this problem:
http://github.com/matthiask/feincms/commit/98e44d0ea4e70e80ca8bd6eff8863a2c54eb2395

I commited to my fork a version of tree_editor.py that checks if the
model has a get_absolute_url method before trying to use it:
http://github.com/nicoechaniz/feincms/commit/17740b4d72b1a80fa5dc14b32beb545ba076058c

I don't know what's the process for you to integrate this simple
modification, I'm new to github.


On 15 feb, 11:31, NicoEchániz <n...@rakar.com> wrote:
> Hi,
>
> I've been trying to use feincms TreeEditor for some mptt registered
> models of mine but I get a bad changelist for the admin.
> The editor still sort of works, but displays (None) for every row in
> the changelist.
>
> At first I thought I was doinig something wrong but then I tried the
> example in feincms and found out that the editor works fine for Pages
> but has the same problem my models have when editing Categories.
>

> I followed this steps:http://magicrebirth.wordpress.com/2009/08/18/django-admin-and-mptt-2/...

Matthias Kestenholz

unread,
Feb 15, 2010, 12:34:48 PM2/15/10
to django-...@googlegroups.com
Hi

On Mon, Feb 15, 2010 at 6:28 PM, NicoEchániz <ni...@rakar.com> wrote:
> Ok,
>
> Looks like this (None) was coming from not having a get_absolute_url()
> method defined in my model.
>
> TreeEditor.__init__ () adds 'indented_short_title' to the admin
> list_display and this indented_short_title method calls a
> get_absolute_url() method from your model which is not present unless
> you define it.
>
> this commit introduced this problem:
> http://github.com/matthiask/feincms/commit/98e44d0ea4e70e80ca8bd6eff8863a2c54eb2395
>
> I commited to my fork a version of tree_editor.py that checks if the
> model has a get_absolute_url method before trying to use it:
> http://github.com/nicoechaniz/feincms/commit/17740b4d72b1a80fa5dc14b32beb545ba076058c
>
> I don't know what's the process for you to integrate this simple
> modification, I'm new to github.
>

You can send a merge request, or a notice to this mailing list. I
still have quite a few branches to review and merge (I'll hopefully be
able to do this tomorrow), but your changes are not controversial at
all and are already merged.

Thanks
Matthias

Reply all
Reply to author
Forward
0 new messages