mirror of
https://github.com/HackSoftware/Django-Styleguide.git
synced 2025-05-29 18:23:18 +03:00
Better to use auto_now_add for that field
This commit is contained in:
parent
bac4059efd
commit
3e8f565dc8
|
@ -217,11 +217,10 @@ Here's an example `BaseModel`:
|
|||
|
||||
```python
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
class BaseModel(models.Model):
|
||||
created_at = models.DateTimeField(db_index=True, default=timezone.now)
|
||||
created_at = models.DateTimeField(db_index=True, auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in New Issue
Block a user