add ordering to menus and pages
This commit is contained in:
parent
74cacbdb5b
commit
53fecaafc1
1 changed files with 3 additions and 3 deletions
|
@ -58,7 +58,7 @@ class Page(MPTTModel, ContentBase):
|
||||||
self.save(calculate_path=False)
|
self.save(calculate_path=False)
|
||||||
|
|
||||||
class MPTTMeta:
|
class MPTTMeta:
|
||||||
order_insertion_by = ["title"]
|
order_insertion_by = ["ordering", "title"]
|
||||||
|
|
||||||
|
|
||||||
class MenuItem(MPTTModel):
|
class MenuItem(MPTTModel):
|
||||||
|
@ -68,14 +68,14 @@ class MenuItem(MPTTModel):
|
||||||
parent = TreeForeignKey("self", null=True, blank=True, related_name="children")
|
parent = TreeForeignKey("self", null=True, blank=True, related_name="children")
|
||||||
|
|
||||||
url = models.CharField(max_length=200)
|
url = models.CharField(max_length=200)
|
||||||
#FIELDNAME = models.ForeignKey()
|
|
||||||
|
|
||||||
published = models.BooleanField(default=True)
|
published = models.BooleanField(default=True)
|
||||||
login_required = models.BooleanField(default=False)
|
login_required = models.BooleanField(default=False)
|
||||||
|
ordering = models.PositiveIntegerField(default=1)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
class MPTTMeta:
|
class MPTTMeta:
|
||||||
order_insertion_by = ["name"]
|
order_insertion_by = ["ordering", "name"]
|
||||||
|
|
Loading…
Reference in a new issue