Skip to content

Commit

Permalink
Merge pull request #52 from akszydelko/master
Browse files Browse the repository at this point in the history
Fix #51 TypeError error when collection field changes (python3 only)
  • Loading branch information
Forrest Pieper authored Jun 26, 2017
2 parents b2efe57 + ac03d82 commit 3e4bb6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions positions/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ def pre_save(self, model_instance, add):
if updated is None:
updated = current
current = None
#elif updated is None:
# updated = -1

# existing instance, position not modified; no cleanup required
if current is not None and updated is None:
return current

# if updated is still unknown set the object to the last position,
# either it is a new object or collection has been changed
if updated is None:
updated = -1

collection_count = self.get_collection(model_instance).count()
if current is None:
max_position = collection_count
Expand Down

0 comments on commit 3e4bb6a

Please sign in to comment.