7👍
✅
Solved this with a small addition to my custom save method. Had to change it from
def save(self, *args, **kwargs):
self.url = self.get_absolute_url()
super(Page, self).save(*args, **kwargs)
to this:
def save(self, *args, **kwargs):
if not self.id:
Page.tree.insert_node(self, self.parent)
self.url = self.get_absolute_url()
super(Page, self).save(*args, **kwargs)
0👍
changing the order should also work, since the object should get an id upon saving and the save()
-method isn’ returning anything!
def save(self, *args, **kwargs):
super(Page, self).save(*args, **kwargs)
self.url = self.get_absolute_url()
- [Django]-Filter on foreign key property in django-nonrel
- [Django]-Permissions : in django rest framework
- [Django]-Django user profile database problem
- [Django]-How do I move project folders in PyCharm Project View?
Source:stackexchange.com