currently I am working with Django

In template, I combined table and form and thus the code looks like this:

<form role="form" method="post">{% csrf_token %}
                <table class="table" border="0.5px" >
                      {% for object in reactioninfo %}
                              <td><input type="checkbox" name="checkbox" 
id="checkbox" value="{{ }}"><a href="{{ object.get_absolute_url 
}}">{{ }}</a></td>
                              <td>{{ }}</td>
                              <td>{{ object.lower_bound }}</td>
                              <td>{{ object.upper_bound }}</td>
                              <td>{{ object.gene_reaction_rule }}</td>
                              <td>{{ object.subsystem }}</td>
                      {% endfor %}
              <button type="submit" id="generate" name="generate" 
value="generate" class="btn btn-default btn-success pull-right">Generate 

And in, the code looks like this:

class MetaboliteDetail(FormMixin, generic.DetailView):
model = Metabolites
template_name = 'Recon/metabolite_detail.html'
def get_context_data(self, **kwargs):
    pk = self.kwargs.get(self.pk_url_kwarg, None)
    context = super(MetaboliteDetail, self).get_context_data(**kwargs)
    context['reactions'] = Reactionsmeta.objects.all()
    context['reactioninfo'] = Reactions.objects.filter(metabolites__contains=pk)
    return context
def generate(self, request):

    checklist = request.POST.getlist('checkbox')
    btnval = request.POST.get('btnDelete')
    if checklist and btnval == 'btnDelete':
       context = dict(result=checklist)
       return render(request, "Recon/combinegraph.html", context)
    elif btnval == 'btnDelete':
         context = dict(result=checklist)
         return render(request, "Recon/combinegraph.html", context)
         context = dict(result=checklist)
         return render(request, "Recon/combinegraph.html", context)

However, when I finished this and click on the Generate button, the url is 
actually not changed and the the page appears HTTP405 error.

What is going wrong and how can I fix this?

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to