¿Cómo puedo eliminar un objeto del conjunto de consultas cuando hago clic en algún botón en la plantilla para la vista Django?
aqui esta mi codigo...
vistas.py
def CamerasList(request): model = Cameras # This function can hadle both the retrieval of the view, as well as the submission of the form on the view. if request.method == 'POST': form = CamerasForm(request.POST, request.FILES) if form.is_valid(): form.delete_cam_id = request.POST.get('delete_cam_id') deletelement = Cameras.objects.get(pk=form.delete_cam_id) deletelement.delete() var = {} var = user_group_validation(request) theuser = request.user theuserid = Users.objects.get(user_id=theuser.id).pk theorgid = Users.objects.get(pk=theuserid).organization_id.pk if var['grupo'] == 'superuser': object_list = Cameras.objects.all() organization = Organizations.objects.all() url = request.session['url'] if var['grupo'] == 'admin' or var['grupo'] == 'user': object_list = Cameras.objects.filter(organization_id=request.session['userInc']) organization = Organizations.objects.filter(id=request.session['userInc']) url = request.session['url'] template = get_template(app+u'/cameras_list.html') return HttpResponse(template.render(locals()))