In a Django project, I have a hierarchical model using MPTT defined like
this in models.py:
class Structure(MPTTModel):
name = models.CharField(max_length=200, unique=True)
parent = TreeForeignKey('self', null=True, blank=True,
related_name='children')
[...]
I'm using FeinCMS to show this hierarchical data in admin pages. I do it
like this in admin.py:
class StructureAdmin(tree_editor.TreeEditor)
search_fields = ('name',)
[...]
admin.site.register(Structure, StructureAdmin)
In the admin model page, it works perfectly and the hierarchy can be seen:
[image: enter image description here]
It also works when editing or adding:
[image: enter image description here]
I have another model in models.py:
class Track(models.Model):
initialStructure = models.ForeignKey(Structure ,
related_name='track_initialStructure')
finalStructure = models.ForeignKey(Structure,
related_name='track_finalStructure')
[...]
However, when adding a new element of this kind, the hierarchy can not be
seen:
[image: enter image description here]
I've tried to use tree_editor.TreeEditor for the admin view of Track but it
gives a lot of errors because Track is not hierarchical, but some of its
ForeignKey's are. How could I show the hierarchy when editing an element of
model Track?
Thank you very much.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.