I have a form with which I want to make an "insert" in one of the models and it gives me the following error and I am not able to know why or debug:
invalid literal for int () with base 10
views.py
def poiUploader(request):
title = "Photo Uploader"
text = "Sube tus fotos"
pois = PoiTxt.objects.filter(lan__lan_id=1)
context = {
"template_title": title,
"template_text": text,
"pois": pois,
}
if request.method == 'POST' and request.FILES['myfile']:
myfile = request.FILES['myfile']
fs = FileSystemStorage()
filename = fs.save(myfile.name, myfile)
uploaded_file_url = fs.url(filename)
saved_poi = request.POST.get('poiCode', '')
poi = Poi.objects.filter(poi_id=saved_poi)
foto = Photo(pho_url=filename, poi=poi)
foto.save()
return render(request, 'poi-uploader.html', {
'uploaded_file_url': uploaded_file_url
})
return render_to_response('poi-uploader.html', context, RequestContext(request))
How should link the poi with the photo with the foreignkey?
Here I leave a link to another thread that I opened from something else and this is my source code.