Hello. I have this code:
class Article(models.Model):
# usefull staff
category = models.ForeignKey("Category")
class Category(models.Model):
parent = models.ForegnKey('self')
I want to display categories selector as a <select>
field with sorted category tree in it.
It should look like
top level category1
lower level1
lower level2
even lower level
even lower level 2
lower level3
top level category2
lower level500
Which is the best way to do this? I hoped to use inheritance from ForeignKey class, but it's sophisticated. Maybe the whole question is "How to inherit from multiply inherited classes?"