I appreciate the help with this everybody and your answers helped me a lot, I just want to clarify what the problem ultimately turned out to be -
class bitcoin_deposit(models.Model):
input_address_db = models.CharField(max_length=34, null=False, blank=False)
deposit_amount_db = models.DecimalField(max_digits=16, decimal_places=8, validators=[MaxValueValidator(21000000)])
return_address_db = models.CharField(max_length=34, null=False, blank=False)
confirmations_db = models.IntegerField(validators=[MinValueValidator(-1)])
created_on_db = models.DateTimeField(primary_key=True, auto_now_add=True)
updated_on_db = models.DateTimeField(auto_now=True)
txlist_db = models.CharField(max_length=64, null=False, blank=False)
I solved the problem by changing txlist_db to the primary key.
Turns out each time the bitcoin network tells your server that you've just received some BTC you actually get the signal about half a dozen times in very very quick succession, so fast in fact that even though I had this model in place -
class bitcoin_deposit_txlist(models.Model):
txlist_db = models.CharField(max_length=64, null=False, blank=False)
and this as this first line of code in the script with the txlist variable representing the network transaction id -
txlist = ''btc network transaction id''
if bitcoin_deposit_txlist.objects.filter(txlist_db=txlist).exists():
exit()
else:
bitcoin_deposit_txlist.objects.create(txlist_db=txlist)
I was still managing to get the same record recorded more than once, amazingly.
Here are the values of some of the deposit objects that helped me solve it -
[
{'return_address_db': u'mpfUAfK8bHi4VejvV4WhjEar3yQvPoX1Yn', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 3, 478489, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 12, 30, 804646, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.14384551'), 'confirmations_db': 1, 'txlist_db': u'7fd82945b5b96ae4ff866b6689867038289b81ee947c8796007d3a9f1fa14b59', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'mmgC3dk3JRpCrS9UDS8QRHFokFd6N8bLz4', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 3, 491573, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 20, 44, 784596, tzinfo=<UTC>), 'deposit_amount_db': Decimal('1.13722512'), 'confirmations_db': 4, 'txlist_db': u'3f9ad1a2464ca33513f24f0e59274845b4ea04906ab0df054ef6668160f58cb2', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'motQ8oo7RcgMmXZVCHgmbq5jtkGnxJwa59', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 28, 550850, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 20, 31, 254955, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.42293583'), 'confirmations_db': 3, 'txlist_db': u'b8e7e819c0ab1dbae9aa106c3662e17eb3621749a4f72e8e8f1b991212f05971', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'motQ8oo7RcgMmXZVCHgmbq5jtkGnxJwa59', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 28, 559947, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 20, 31, 165585, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.42293583'), 'confirmations_db': 3, 'txlist_db': u'b8e7e819c0ab1dbae9aa106c3662e17eb3621749a4f72e8e8f1b991212f05971', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'mzgA1rXEuV59Zho34o5Lvko6LFpV9hWUq8', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 54, 666174, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 20, 44, 837193, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.11976356'), 'confirmations_db': 4, 'txlist_db': u'adbcfc5b70621bde28ba4f073eca7a12e70533fb57e617ddbce013b4f6bc063b', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'mzgA1rXEuV59Zho34o5Lvko6LFpV9hWUq8', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 54, 678403, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 20, 31, 293935, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.11976356'), 'confirmations_db': 3, 'txlist_db': u'adbcfc5b70621bde28ba4f073eca7a12e70533fb57e617ddbce013b4f6bc063b', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'mzgA1rXEuV59Zho34o5Lvko6LFpV9hWUq8', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 54, 688175, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 15, 53, 125196, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.11976356'), 'confirmations_db': 2, 'txlist_db': u'adbcfc5b70621bde28ba4f073eca7a12e70533fb57e617ddbce013b4f6bc063b', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'},
{'return_address_db': u'mzgA1rXEuV59Zho34o5Lvko6LFpV9hWUq8', 'created_on_db': datetime.datetime(2014, 8, 7, 8, 8, 54, 695733, tzinfo=<UTC>), 'updated_on_db': datetime.datetime(2014, 8, 7, 8, 20, 44, 611634, tzinfo=<UTC>), 'deposit_amount_db': Decimal('0.11976356'), 'confirmations_db': 4, 'txlist_db': u'adbcfc5b70621bde28ba4f073eca7a12e70533fb57e617ddbce013b4f6bc063b', 'input_address_db': u'mrcLfESBQqqRG3ZqKhwcjfVgsM4REvt2cL'}
]
Notice how close the created_on_db field values are.
Thanks again :)
input_address_db=i.input_address_dbtoinput_address_db__exact=i.input_address_db