def post(self, request, *args, **kwargs): if request.is_ajax(): list, photos = request.user.get_photo_list(), [] for p in request.FILES.getlist('file'): photo = Photo.create_photo(creator=request.user, image=p, list=list) photos += [photo] return render_for_platform(request, 'user_gallery/new_list_photos.html', {'object_list': photos}) else: raise Http404
def post(self, request, *args, **kwargs): from common.templates import render_for_platform list = PhotoList.objects.get(pk=self.kwargs["pk"]) if request.is_ajax() and list.is_user_can_create_el(request.user.pk): photos = [] uploaded_file = request.FILES['file'] for p in request.FILES.getlist('file'): photo = Photo.create_photo(creator=request.user, image=p, list=list, type="PHLIS", community=list.community) photos += [photo,] return render_for_platform(request, 'gallery/new_photos.html',{'object_list': photos, 'list': list, 'community': list.community}) else: raise Http404
def post(self, request, *args, **kwargs): community = Community.objects.get(pk=self.kwargs["pk"]) if request.is_ajax() and request.user.is_administrator_of_community( community.pk): photo_input = request.FILES.get('file') _list = PhotoList.objects.get(community=community, type=PhotoList.AVATAR) photo = Photo.create_photo(creator=request.user, image=photo_input, list=_list, type="PHAVA", community=community) community.create_s_avatar(photo_input) community.create_b_avatar(photo_input) return HttpResponse() else: return HttpResponseBadRequest()
def post(self, request, *args, **kwargs): user = User.objects.get(pk=self.kwargs["pk"]) if request.is_ajax() and user == request.user: photo_input = request.FILES.get('file') _list = PhotoList.objects.get(creator=user, type=PhotoList.AVATAR, community__isnull=True) photo = Photo.create_photo(creator=user, image=photo_input, list=_list, type="PHAVA", community=None) request.user.create_s_avatar(photo_input) request.user.create_b_avatar(photo_input) return HttpResponse() else: return HttpResponseBadRequest()
def post(self, request, *args, **kwargs): photos = [] if request.is_ajax(): list = PhotoList.objects.get(creator=request.user, type="WAL", community=None) for p in request.FILES.getlist('file'): photo = Photo.create_photo(creator=request.user, image=p, list=list, type="PHWAL", community=None) photos += [ photo, ] return render_for_platform(request, 'gallery/new_photos.html', { 'object_list': photos, 'list': list }) else: raise Http404