Adding html attribute to existing table in existing djangitables2 table - html

I want to add a column with a hyperlink to my existing table which I created using djangotables2
I tried this but did not work for me.
I am able to add an extra column but the header name but the columns do not show anything in the cells. Could you please guide me on it?
Below is my code
class PDFColumn(tables.Column):
def render(self, value):
return format_html('PDF pdf link', value)
class MYTable(tables.Table): #this is my existing lass table on view page
PDF = PDFColumn()
Now able to see any data within the columns, only column appears with header name PDF

Related

Picture can't be displayed when adding picture to copied table using python-docx

I'm using python-docx to edit an existing word file. I've created a simpler case where it also fails starting with a blank document. Adding a picture to a cell in a table works just as expected. But if I want to copy that table, there seems to be a problem when I add an image to the new table. I've looked elsewhere, but this problem seems to be unique to copied tables only.
from copy import deepcopy
from docx import Document
doc = Document()
table1 = doc.add_table(rows=2, cols=2)
table1.style = 'TableGrid'
table2 = deepcopy(table)
table2._tbl = deepcopy(table1._tbl)
p = doc.add_paragraph()
p._p.addnext(table2._tbl)
# Add image to table 1
cell = table1.rows[0].cells[0]
cell.paragraphs[0].add_run().add_picture("picture.png", width=Cm(10))
# Add image to table 2
cell = table2.rows[0].cells[0]
cell.paragraphs[0].add_run().add_picture("picture.png", width=Cm(10))
doc.save("t.docx")
Problem: If I add the same image to both, it will appear correct. If I add it to only table 1, it also works. But if I add it to the copy, then it fails and looks like this:
It seems to be something that is different in the second, copied table. I know it looks like a hack the way it was created. I did it this way because, in my original document, the table is quite complex and needs to be duplicated for each case.
(Edit: added missing deepcopyimport)

How can we create a entry form using Formtemplates?

Step 1: Collect requirements from the client.
Step 2: Complete the design part from the CSS team.
Step 3: Create Entity.
Step 4: You can access the Form template by logging into technical support.
Create a new form template with template code, template name.
Select the master type, and form type also fill in the required fields
What is outer Html?
Ans: An outer HTML defines the outer cover div of an HTML file.
What is Inner Html?
Ans: An Inner HTML defines the cover div which is looping for a field.
What is a Template list query?
Ans: The list query for saved data.
enter image description here
Section in Formtemplates
We can split the HTML file into multiple sections and the outer part (outer cover div) will keep in the outer HTML.
We can add fields by clicking Create fields
We can also add additional classes, styles, override names,s, etc in the create field.
We can add a formula with the fields
if you want to add functionality with a query we can write the query in the form of template functions
Step 1: Collect requirements from the client.
Step 2: Complete the design part from the CSS team.
Step 3: Create Entity.
Step 4: You can access the Form template by logging into technical support.
Create a new form template with template code, template name.
Select the master type, and form type also fill in the required fields
What is outer Html?
Ans: An outer HTML defines the outer cover div of an HTML file.
What is Inner Html?
Ans: An Inner HTML defines the cover div which is looping for a field.
What is a Template list query?
Ans: The list query for saved data.
enter image description here
Section in Formtemplates
We can split the HTML file into multiple sections and the outer part (outer cover div) will keep in the outer HTML.
We can add fields by clicking Create fields
We can also add additional classes, styles, override names,s, etc in the create field.
We can add a formula with the fields
if you want to add functionality with a query we can write the query in the form of template functions

Example to combine headers footers paragraphs of html and Tables

jspdf-autotable examples['header-footer'] example gets me most of what I need for my task.
I am trying to add rich text (constant font some bold and under line words) before and after a table. looking at examples.content did not make it clear.
So a complete PDF might be:
1. some paragraphs of text
2. a table on more than one page
3. some paragraphs of text
4. another table on more than one page
how do I combine all of this in one var doc = new jsPDF(); ?
Example code would be very appreciated.
The key is to use doc.autoTable.previous.finalY to get the final y position where the table ended drawing. You can than dynamically use that to draw text with doc.text(). If you want further guidence, please update your question with more info on what you have tried and what didn't work.

add html to an individual cell in a datatable in powershell

In powershell I have a datatable that contains a columns of ID's. I am trying to add a specific hyperlink to each of the ID's.
for example if the value in the cell of the ID column is 12345 it will link to www.google.com/12345
I have tried adding the html to the string inside the datatable, but whenits outputted instead of making it a hyperlink it simply shows the href code

Add HTML 5 data attribute to a newly created row when table is using datatable js

I have a HTML table with each row with HTML5 data attribute. The table is using jQuery Datatables plug-in. Now when I am adding a new row on a click of button how to add HTML5 data attribute to it again. The data attribute value is specified by the user.
Data attribute write:
$('#categories-table').dataTable
'createdRow': (row, data, dataIndex) ->
$(row).attr('data-category-id', data[0])
Data attribute read:
$('#categories-table tbody').on 'click','tr', () ->
console.log $(this).data('category-id')
You may want to look at http://datatables.net/reference/option/columns.createdCell
that's a callback for once the cell is created so you can modify it and add your custom attributes or for the row http://datatables.net/reference/option/createdRow
(using the current v1.10.4)