i wrote a save function like that class ProductAdmin(admin.ModelAdmin): def save_model(self, request, obj, form, change): from os.path import dirname, join, splitext from shutil import move as rename extension = splitext(obj.image.path)[-1] new_image_path = join(dirname(obj.image.path), obj.slug + extension) rename(obj.image.path, new_image_path) obj.image = new_image_path obj.save()
it is working but, when i saving it from admin site, image urls are being wrong and being same as file path. see : In [1]: from products.models import Product In [2]: p = Product.objects.get(id=1) In [3]: p.image.path Out[3]: u'/home/horselogy/django/mmm/media/product_images/akatis.png' In [4]: p.image.url Out[4]: u'http://localhost:8000/home/horselogy/django/mmm/media/product_images/akatis.png' why it is being like that? what am i doing wronG? Thanks for your response -- Mirat Can Bayrak <miratcanbay...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---