Use pk instead of id

master
endeav 2016-02-19 15:27:50 +01:00
parent c1181b0e52
commit ce091c34c6
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ class SortableMixin(models.Model):
'typecast to an integer.'
def save(self, *args, **kwargs):
if not self.id:
if not self.pk:
try:
current_max = self.__class__.objects.aggregate(
models.Max(self.order_field_name))[self.order_field_name + '__max'] or 0