I want to create Dynamic Upload Path for my models as follows. Models.py. --------------------------------------------------------------- class Books(models.Model): no=models.IntegerField()
class Collection(models.Model): Page=models.ForeignKey('Books') image=models.ImageField(upload_to='Book_Media') def save(self): for field in self._meta.fields: if field.name == 'image': field.upload_to = 'Book_Media/'+str(self.Page.no) super(Collection, self).save() --------------------------------------------------------------------- Issue: --------- When ever i upload an image in 'Collection Models', the image is stored in previous object path. how can we overcome this ? Or else is there any other solution for DYNAMIC PATH based on object? Thanks & Regards, Jayapal --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---