Here is my Django model:
class mymodel(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
deleted_at = models.DateTimeField(null=True, blank=True)
How can I make the object created only once per 24 hours? I know it's possible to do with unique_for_date but cannot understand how https://docs.djangoproject.com/en/4.1/ref/models/fields/#unique-for-date
Also, I want to show an error if the user wanted to create more than once per 24 hours.
source https://stackoverflow.com/questions/73690759/django-make-the-object-create-only-once-per-24-hours
Comments
Post a Comment