I have a model with a custom method like so:
class MyModel(models.Model):
some_counter_field = models.IntegerField(blank=True, default=0)
def my_custom_method(self):
if (self.some_counter_field < 5):
self.some_counter_field += 1
self.save()
return True
else:
return False
The only place this method is called is in one of my templates.
I was using the Django Admin interface to facilitate testing this, so I could easily reset some_counter_field back to 0. However, I noticed that just by viewing an instance of this model in the admin interface was causing some_counter_field to be incremented until it hit 5. What is also strange is that this only happens in production, I was not able to reproduce this with my local runserver, even when I had DEBUG=False like production has.
Any ideas as to what might be going on here?
Thanks!
Greg