adamcharnock/django-hordak

Improve account creation

rajesh188 opened this issue · 4 comments

This line
initial["code"] = "{0:02d}".format(Account.objects.count() + 1)
Fails integrity constraint when deleting intermediate accounts
It should be set like this i think
initial["code"] = "{0:02d}".format(Account.objects.latest(). Id + 1)

For example you create 10accounts and then in the middle you delete 5th and 6th account then try to create other new accounts fails parent code unique together constraint

Hey @rajesh188, my apologies for the delay, and thank you very much for catching this. I've just implemented the fix as you suggested (see above commit).

Just released 1.8.2