34
33
return super(ImageManager, self).create(**keyw)
36
def create_and_save_image(self, user, image, content_type, object_id):
35
def create_and_save_image(self, user, image, content_type, object_id, ip):
37
36
# Use Django's get_valid_name() to get a safe filename
38
37
storage = FileSystemStorage()
39
38
safe_filename = storage.get_valid_name(image.name)
40
39
im = self.create(content_type=content_type, object_id=object_id,
40
user=user, revision=1, name=image.name, editor_ip=ip)
42
41
path = '%swlimages/%s' % (MEDIA_ROOT, safe_filename)
44
43
destination = open(path, 'wb')