Closed GoogleCodeExporter closed 9 years ago
Thanks for this - it might be bit messy, but it's a great start in terms of how
to
get MPTT hooked into the admin. Haven't had time to look into it myself yet, so
this
will be a great help.
Original comment by jonathan.buchanan
on 12 Oct 2008 at 7:10
This is an excellent addition to an already already project, many thanks.
Although this isn't a django-mptt problem, per se:
I have the patch working using Firefox on my mptt model but using IE7 I get a
"Done,
but with errors on page" message in the status area and no NestedSortableWidget
is
displayed. No further errors are displayed.
Is this a known problem?
Original comment by absolute...@googlemail.com
on 3 Feb 2009 at 12:03
I have solved the IE error problem by removing the spurious comma from the
buildNSW
() code in change_list.html:
...
onSave: function(){
$('#my_widget').NestedSortableWidgetDestroy();
buildNSW();
}, <-- here
...
Hope that's of help to someone else.
Original comment by absolute...@googlemail.com
on 3 Feb 2009 at 12:16
Disclaimer: I'm the primary author of tusk cms, and I can't say I'm very proud
of the
code there.
In the meantime, we have completely rewritten the code and made it much more
extensible. In fact, the tree view is already working for several models. There
are
still some things left such as respecting list_display. I don't think it makes
much
sense trying to add support for pagination or list_filter, but maybe someone
else has
a different opinion (and code to support it)
Original comment by matthias...@gmail.com
on 26 Feb 2009 at 10:59
Oops. I wanted to add a link to an email I sent to django-users here, sorry for
clicking submit too fast.
http://groups.google.com/group/django-users/browse_thread/thread/b543144640ac1d4
a
Original comment by matthias...@gmail.com
on 26 Feb 2009 at 10:59
Thanks for mptt_admin.diff! Works great!
Original comment by T.Karbow...@gmail.com
on 21 May 2009 at 3:54
[deleted comment]
The possibility of using MPTT in admin made me start using it. Thanks for your
efforts.
However, the data does not show up in the change list view, and the url to sen
the
json object (http://localhost:8000/admin/bio/taxonomy/json/?rnd=...) raises an
exception:
"invalid literal for int() with base 10: 'json'"
I am using a recent SVN version of Django. I think in the MpttModelAdmin,
get_urls()
method should be overriden instead of the deprecated __call__(). But I couldn't
figure out how.
I tried copying the get_urls() into the MpttModelAdmin and adding the json url
as such:
def get_urls(self):
[...]
urlpatterns = patterns('',
[...]
url(r'^(.+)/$',
wrap(self.change_view),
name='%sadmin_%s_%s_change' % info),
url(r'^(.+)/json/$',
wrap(self.json_view),
name='%sadmin_%s_%s_json' % info),
)
return urlpatterns
but i am still getting the same error.
Original comment by omat%gez...@gtempaccount.com
on 29 Jun 2009 at 4:10
I should be more careful with the urlpatterns. I get it working like this:
def get_urls(self):
...
urlpatterns = patterns('',
url(r'^json/$',
wrap(self.json_view),
name='%sadmin_%s_%s_json' % info),
...
But _build_tree() method also needs to be modified to supply the extra 'form'
parameter required by items_for_result() function:
def _build_tree(nodes, cl):
ret = []
for obj in nodes:
dic = {
'id': obj.id,
'info': list(items_for_result(cl, obj, form=None)), # form param added
}
Though the resulting form does look a bit deformed because of the checkboxes
added,
it works.
Original comment by omat%gez...@gtempaccount.com
on 30 Jun 2009 at 4:43
I tried implementing your fixed with the overridden get_urls but I can't figure
out
where your 'info' variable is coming from, what is it?
Original comment by andreple...@gmail.com
on 14 Jul 2009 at 10:49
Sorry, I've cropped that line too when pasting. 'info' is:
info = self.admin_site.name, self.model._meta.app_label,
self.model._meta.module_name
Set it just before urlpatterns = patterns(....).
Original comment by omat%gez...@gtempaccount.com
on 15 Jul 2009 at 6:21
the original diff posted at the top of this page worked all right for me !!
Thanks!!!
(I'm running Django 1-0 )
Only thing I had to fix was the path to the media files in new admin.py file,
e.g.:
instead of "mptt/jquery-1.2.6.min.js" I put something like
"/pathtomymedia/mptt/jquery-1.2.6.min.js"... I guess
that an alternative solution is to modify the urls.py file accordingly!
Original comment by michele.pasin
on 6 Aug 2009 at 6:21
Attachments:
Hi there - a small update: the tree visualization needs to be improved cause if
there are a lot of lines (e.g. more
than 1000) the js runs into memory problems and it crashes. I guess that one
solution would be a pagination
mechanism; another one is building a mechanism to open/close the nodes and load
the children-data on
demand, via ajax. Unfortunately I don't have much time to implement a fix now,
but if I do I'll be posting it
here...
Has any of you run into similar problems?
Original comment by michele.pasin
on 12 Aug 2009 at 11:01
Disclaimer: I'm the original author of tusk CMS, which I've abandoned a long
time ago.
I'd recommend anyone interested in managing tree stuctures to look into
FeinCMS, which
has a ModelAdmin subclass that you can just inherit from to get a tree
administration
interface; it's called feincms.admin.tree_editor.TreeEditor. More information
here:
http://spinlock.ch/pub/feincms/ (Screenshots & Links)
Original comment by matthias...@gmail.com
on 12 Aug 2009 at 11:35
Hi there - to whoever might be interested - I posted a bunch of simple
instructions for using MPTT with
FeinCms adminTree class here:
http://magicrebirth.wordpress.com/2009/08/18/django-admin-and-mptt-2/
Matthias, tx again for the useful tips!!!
Original comment by michele.pasin
on 18 Aug 2009 at 10:52
I found a bug in admin json.js: when we drag element from level1 (tree_id=1) to
level0 and save, the tree_id will be still 1. But when we add a new element to
level0
he will have tree_id=2. This bug of holding the tree_id number may cause errors
when
you use get_root() - there will be two elements with 'parent__isnull': True and
'tree_id': 1.
Original comment by adwo...@pdll.pl
on 19 Jan 2010 at 11:30
im on django 1.1.1 using sqlite3 and if i want to look at my objects in the
admin i
get a "Could not load the data from the server." any hints?
Original comment by a.schmi...@gmail.com
on 26 Jan 2010 at 3:03
I removed the bug that didn't increase tree_id.
admin.py
-if parent == 'NULL':
+if parent == None:
Original comment by T.Karbow...@gmail.com
on 27 Apr 2010 at 8:37
Attachments:
People - with relation to my comment above [n. 15] - the example code have
moved here:
http://www.michelepasin.org/techblog/?p=275
Thanks,
m
Original comment by michele.pasin
on 17 Jun 2010 at 5:43
Original comment by craig.ds@gmail.com
on 3 Sep 2010 at 12:11
Original comment by craig.ds@gmail.com
on 6 Sep 2010 at 9:17
See google group discussion re admin changes for 0.4:
http://groups.google.com/group/django-mptt-dev/browse_thread/thread/63f9fc221246
f527
Original comment by craig.ds@gmail.com
on 28 Sep 2010 at 12:11
Done in 0.4, with a bare-bones ModelAdmin and a FeinCMS one for those with
FeinCMS
Original comment by craig.ds@gmail.com
on 1 Oct 2010 at 5:39
Original issue reported on code.google.com by
ben.firs...@gmail.com
on 10 Sep 2008 at 6:09Attachments: