python - django formsets can_delete header -


I'm new to the deegago, please stand with me ..

generated a template It all works well, except I am unable to provide the header in the can_delete column.

My Django looks.py looks like this:

  def add_exchange (request): reference = requestContacts (request) ExpFormSet = Modelformset_factory (expense, excess = 1, max_num = 10, fields = ('exp_date', 'description', 'amount'), can_delete = true) if request.method == 'POST': formset = exp.conf (request.POST ) If formset.sis_valid (): Formset.save (commit = true) formset = expformet () Other: print "Errors are formset", formset.errors else: formset = expformet (queryset = expenditure.objects.none ()) The form of the temple code is given below:  
  
id = "expense_form" method = "post" action, return render_to_response ('moni')

= "/ Moni / ad_expect / "& gt; {% Csrf_token%} & lt; Table range = 10> & lt; tr & gt; & lt; th & gt; serial number & lt ; Th> gt; Label & gt; Date: & lt; / label & gt; & lt; / th> & lt; th & gt; & lt; label = "id_description" & gt; Details: & lt; / label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Label = "id_amount" & gt; Quantity & lt; / Label & gt; & Lt; / Th & gt; & Lt; / TR & gt; {{Formset.management_form}}%} for form in {form set%} & lt; Tr & gt; & Lt; TD & gt; {{Forloop.counter}} & lt; / TD & gt; {% In field%} & lt; Td> {{Field.class}} {{field}} {% if field.name == "exp_date"%} & lt; A href = "javascript: void (0)" class = "todaylink" id = {{forloop.parentloop}. Counter0}} & gt; Today & lt; / A & gt; {% Endif%} & lt; / Td> {% Endfor%} & lt; / Tr & gt; & Lt; Br> {% Endfor%} & lt; / Table & gt; & Lt; Input type = "submit" name = "submit" value = "create expense" / & gt; & Lt; / Form & gt;

And the template looks like this:

image description Enter

What do I want to have a header for the Delete check box? Just next to the amount I tried to add another header but it seems that it is not intended is. Anyone can provide any advice. How does this look after adding another header below

   & Lt; TR & gt; & Lt; Th & gt; Serial Number & lt; / Th & gt; & Lt; Th & gt; & Lt; Label & gt; Date: & lt; / Label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; For label = "id_description" & gt; Details: & lt; / Label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Label = "id_amount" & gt; Quantity & lt; / Label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Label = "id_delete" & gt; Remove & lt; / Label & gt; & Lt; / Th & gt; & Lt; / TR & gt; {{Formset.management_form}}%} for form in {form set%} & lt; Tr & gt; & Lt; TD & gt; {{Forloop.counter}} & lt; / TD & gt; {% In field%} & lt; Td> {{Field.class}} {{field}} {% if field.name == "exp_date"%} & lt; A href = "javascript: void (0)" class = "todaylink" id = {{forloop.parentloop}. Counter0}} & gt; Today & lt; / A & gt; {% Endif%} & lt; / Td> {% Endfor%} & lt; / Tr & gt; & Lt; Br> {% Endfor%} & lt; / Table & gt; & Lt; Input type = "submit" name = "submit" value = "create expense" / & gt; & Lt; / Form & gt;   

enter image details here

any Also, as a way to make headers on the deleted check box?

problem

  {% in field}  {{Field.class}} {{field}} {% if field.name == "exp_date"%} & lt; A href = "javascript: void (0)" class = "todaylink" id = {{forloop.parentloop}. Counter0}} & gt; Today & lt; / A & gt; {% Endif%} & lt; / Td> {% Endfor%}   

Make this 5 TD and you have 4 TD in the header.

Please try it

  & lt; & Gt; TR; & Lt; Th & gt; Serial Number & lt; / Th & gt; & Lt; Th & gt; & Lt; Label & gt; Date: & lt; / Label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; For label = "id_description" & gt; Details: & lt; / Label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Label = "id_amount" & gt; Quantity & lt; / Label & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Label = "id_delete" & gt; Remove & lt; / Label & gt; & Lt; / Th & gt; & Lt; / TR & gt;   

In addition to this you can delete the element before removing the check box.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -