def nonvessel(request, country, project_no): if country: country = country.upper() recipient = Recipient.objects.select_related().get(recipient_id=project_no) full_row = FishData.objects.get_latest_row(project_no) comments = RecipientComment.public.filter(recipient=recipient) form = RecipientCommentForm() if request.POST: initial_data = { 'user' : request.user, 'recipient' : recipient, } form = RecipientCommentForm(request.POST, initial=initial_data) save_form = form.save(commit=False) save_form.user = request.user save_form.recipient = recipient save_form.save() return HttpResponseRedirect(reverse('vessel', args=[recipient.country,recipient.pk, recipient.name])) total = 0 return render_to_response( 'recipient.html', { 'form' : form, 'recipient' : recipient, 'total' : total, }, context_instance=RequestContext(request) )
def vessel(request, country, cfr, name): if country: country = country.upper() recipient = Recipient.objects.select_related().get(recipient_id=cfr) full_row = FishData.objects.get_latest_row(cfr) total = 0 infringement_record = illegalFishing.objects.select_related().filter(recipient=cfr) comments = RecipientComment.public.filter(recipient=recipient) form = RecipientCommentForm() if request.POST: initial_data = { 'user' : request.user, 'recipient' : recipient, } form = RecipientCommentForm(request.POST, initial=initial_data) save_form = form.save(commit=False) save_form.user = request.user save_form.recipient = recipient save_form.save() return HttpResponseRedirect(reverse('vessel', args=[recipient.country,recipient.pk, recipient.name])) return render_to_response( 'recipient.html', { 'comments' : comments, 'form' : form, 'recipient' : recipient, 'full_row' : full_row, 'infringement_record' : infringement_record, 'total' : total, }, context_instance=RequestContext(request) )