User 74bc064b3d
11-06-2012 08:19:23
Hi,
I want to use MarvinSketch with my Django project, especially the image saving function. I wonder how can I use the imageSaveUrl. How can I trigger it? My html now is:
<script type="text/javascript" SRC="../media/js/marvin/marvin.js"></script>
<script type="text/javascript">
<!--
msketch_begin("../media/js/marvin", 540, 480);
msketch_param("imageSaveURL","/create_image");
msketch_end();
//-->
</script>
My /create_image will call a function (which I think it should be similar to a jsp). Sorry if you feel what I did is crazy because I don't know anything about neither jsp nor asp. :(
def create_image(request):
if request.raw_post_data:
source = request.raw_post_data
dest_file = open('a_random_new_filename',request.user.id,'wb+'))
dest_file.write(source)
dest_file.close()
return HttpResponse('a_random_new_filename',request.user.id))
else:
raise HttpResponse('invalid')
Thanks in advance!