Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I pass extra variable from upload views to the template ? #26

Open
Varnan opened this issue May 21, 2015 · 0 comments
Open

How can I pass extra variable from upload views to the template ? #26

Varnan opened this issue May 21, 2015 · 0 comments

Comments

@Varnan
Copy link

Varnan commented May 21, 2015

JFU upload from View Repo

@require_POST
@login_required
def view_repo_upload(request):

file = upload_receive( request )
pid=int(request.REQUEST.get('product_id'))
p = Product.objects.get(id=pid)
instance = ProductGallery(product=p,image=file)
instance.save()

basename = os.path.basename( instance.image.path )
remaining_count = settings.IMAGE_COUNT - p.image_count()

file_dict = {
    'name' : basename,
    'size' : file.size,
    'url': settings.MEDIA_URL+'/images/product/'+ basename,
    'thumbnailUrl': settings.MEDIA_URL +'/images/product/'+ basename,
    'deleteUrl': reverse('jfu_delete', kwargs = { 'pk': instance.pk }),
    'deleteType': 'POST',

}


return UploadResponse( request, file_dict)

From this View , how can I pass the value of the 'remaining_count' to the corresponding template?

Please help me out ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant