def photo_load(request, pk, apk): o = get_object_or_404(Object, pk=pk) a = get_object_or_404(Album, pk=apk) if request.method == 'POST': for file in request.FILES.getlist('file'): p = Photo() p.owner = request.user p.published_date = timezone.now() p.album = a p.photo.save(str(file), file, save=True) p.thumb_make() p.save() return redirect('object.views.object_view', pk=o.pk)
def photo_load (request, pk, apk): o = get_object_or_404(Object, pk=pk) a = get_object_or_404(Album, pk=apk) if request.method == 'POST': for file in request.FILES.getlist('file'): p = Photo() p.owner = request.user p.published_date = timezone.now() p.album = a p.photo.save(str(file),file,save=True) p.thumb_make() p.save() return redirect('object.views.object_view', pk=o.pk)