Ajouter un an à id django
import datetime
from uuid import uuid4
def create_id():
now = datetime.datetime.now()
return str(now.year)+str(now.month)+str(now.day)+str(uuid4())[:7]
# in your model:
id = models.CharField(primary_key=True, default=create_id, editable=False)
Difficult Dogfish