Avatar ·

The dynamic path for Upload_to in the Django model (Models.filefield)

📁 lambda, python, django, ии

Hello, in Django to version 1.4 there was the opportunity in the model for models.filefield to specify “dynamically” “The created path of storing files in the variable Upload_to

  Models.py #...  attach = models.filefield (Verbose_name = , Blank =  true , upload_to =  lambda  Instance, Filename: %(Instance.  id , filiname)     

d django version 1.4 is like ID is assigned later and therefore Instance.id = None and also Instance.pk = None. Tell me how to point out the ID model on the way.