Hey, Just wondering if "save as new" should also save any files (in this case images) along with everything else? Currently OtherInlines' information gets copied to the saved as new object, but any images associated with the original object are not.
models.py: class ProductImage(models.Model): def custom_upload_to(self, filename): return "upload/product_images/%s/%s" % (self.product.id, filename) product = models.ForeignKey('Product', related_name='product_image') image = models.ImageField(upload_to=custom_upload_to) def show_thumb(self): return '<img src="%s%s" width="100" />' % (MEDIA_URL, self.image) show_thumb.allow_tags = True def __unicode__(self): return u"%s" % self.id class Other(models.Model): product = models.ForeignKey('Product', related_name='product_other') text = models.CharField(max_length=250) def __unicode__(self): return u"%s" % (self. text) admin.py: class ImageInline(admin.StackedInline): model = ProductImage extra = 2 class OtherInline(admin.StackedInline): model = Other extra = 2 class ProductAdmin(admin.ModelAdmin): inlines = [ OtherInline, ImageInline ] save_as = True admin.site.register(Product, ProductAdmin) Regards, Pawel. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---