These are chat archives for django/django
can you tell me someone how can auto define
name field in my model using name from path image ?because i use multi upload images i want to define names of images automate.
in simple python that look like this this :
filepath = 'C:/Users/username/Desktop/dj/imagename.png' layer_name = filepath[:-4].split('/')[-1] # get the layer name
my model :
class MyModel(models.Model): name = models.CharField() user = models.ForeignKey(User, unique=False) upload = models.ImageField(upload_to=user_directory_path)