There is no t_upload_path
2013/1/25 Sammael <s4mm...@gmail.com> > Hello, folks! > > Here is the relevant part of my model: > > def i_upload_to(instance, filename): > return '/'.join([strftime('i/%y%m/%d'), filename]) > > def t_upload_to(instance, filename): > return '/'.join([strftime('t/%y%m/%d'), filename]) > > class Image(models.Model): > image = models.ImageField(upload_to=i_upload_to, blank=True) > thumbnail = models.ImageField(upload_to=t_upload_to, blank=True) > > > It works as expected, but it's really ugly, terrible code. Let's try to make > it a little better: > > def upload_path(p): > return lambda instance, filename: '/'.join([p, strftime('%y%m/%d'), > filename]) > > > class Image(models.Model): > image = models.ImageField(upload_to=upload_path('i'), blank=True) > thumbnail = models.ImageField(upload_to=t_upload_path('t'), > blank=True) > > > In this case 'image' will be uploaded where expected (e.g. 'i/1301/26'), > but thumbnail will be uploaded to directory like 't/1301/25/i/1301/26/' > instead of 't/1301/26'. > > Any opinions? Where do I make a mistake? > > Thank you in advance for any advice. > > -- > 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. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.