Bloks

Blok attachment

class anyblok_attachment.bloks.attachment.AttachmentBlok(registry)

Bases: anyblok.blok.Blok

Add attachment in AnyBlok

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
classmethod import_declaration_module()
name = 'attachment'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['anyblok-core']
required_by = ['report']
version = '1.0.0'

Memento

The document historize the version:

doc = registry.Attachment.Document.insert(...)
assert doc.type == 'latest'
assert doc.previous_version is None

doc.data = {'other': 'data'}
assert doc.previous_version is not None
assert doc.previous_version.type == 'historized'

You can get:

  • All document:

    registry.Attachment.Document.query().all()
    
  • Only the latest:

    registry.Attachment.Document.Latest.query().all()
    
  • Only the historized:

    registry.Attachment.Document.History.query().all()
    

Note

If one entry changed and a file is available then a historied version will be autmaticly created.

The historized version get the latest version of the document and a new version is added to the document

API doc

Attachment

class anyblok_attachment.bloks.attachment.attachment.Attachment

Bases: object

Name space for the attachment models

Declaration type:
 Model
Registry name:Model.Attachment
Tablename:attachment
Inherit model or mixin:
 

Documments

class anyblok_attachment.bloks.attachment.document.Document

Bases: object

Declaration type:
 Model
Registry name:Model.Attachment.Document
Tablename:attachment_document
Inherit model or mixin:
 
field name Description
hash
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 256
created_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - False
  • nullable - False
  • Context:
filesize
  • Field type - <class ‘anyblok.column.Integer’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
data
  • Field type - <class ‘anyblok.column.Json’>
  • Label - None
  • default - <class ‘dict’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
file
  • Field type - <class
‘anyblok.column.LargeBinary’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
filename
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 256
previous_versions
  • Field type - <class ‘anyblok.field.Function’>
  • Label - None
  • fget - get_previous_versions
  • Context:
previous_doc_version
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
version
  • Field type - <class ‘anyblok.column.String’>
  • primary_key - True
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • nullable - False
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • foreign_key - None
contenttype
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
uuid
  • Field type - <class ‘anyblok.column.UUID’>
  • primary_key - True
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • nullable - False
  • DB column name - None
  • Context:
  • is crypted - False
  • foreign_key - None
type
  • Field type - <class
‘anyblok.column.Selection’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections:
  • history - History
  • latest - Latest
  • size - 64
  • nullable - False
previous_doc_uuid
  • Field type - <class ‘anyblok.column.UUID’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
file_added_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - False
  • Context:
previous_version
  • Field type - <class ‘anyblok.field.Function’>
  • Label - None
  • fget - get_previous_version
  • Context:
next_version
  • Field type - <class ‘anyblok.field.Function’>
  • Label - None
  • fget - get_next_version
  • Context:
historied_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - False
  • Context:
class anyblok_attachment.bloks.attachment.document.Latest

Bases: anyblok.model.Document, anyblok.mixin.ForbidDelete

Declaration type:
 

Model

Registry name:

Model.Attachment.Document.Latest

Tablename:

attachment_document

Inherit model or mixin:
 
  • <class ‘anyblok.model.Document’>
  • <class ‘anyblok.mixin.ForbidDelete’>
class anyblok_attachment.bloks.attachment.document.History

Bases: anyblok.model.Document, anyblok.mixin.ReadOnly

Declaration type:
 

Model

Registry name:

Model.Attachment.Document.History

Tablename:

attachment_document

Inherit model or mixin:
 
  • <class ‘anyblok.model.Document’>
  • <class ‘anyblok.mixin.ReadOnly’>

Exceptions

exception anyblok_attachment.bloks.attachment.exceptions.NoFileException

Document has not got file entry

exception anyblok_attachment.bloks.attachment.exceptions.ProtectedFieldException

Try to update protected field

Blok wkhtml2pdf

class anyblok_attachment.bloks.wkhtml2pdf.WkHtml2PdfBlok(registry)

Bases: anyblok.blok.Blok

Add attachment in AnyBlok

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
classmethod import_declaration_module()
name = 'wkhtml2pdf'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['anyblok-core']
required_by = []
version = '1.0.0'

Memento

Define tools to convert HTML to PDF with wkhtmltopdf.

To use WkHtml2Pdf in your template is easy:

@register(Model.Attachment.Template)
class MyTemplate(Mixin.WkHtml2Pdf):
    ... # template configuration

    def render(self, data):
        html_content = ...
        return self.wkhtml2pdf(html_content)

You may define one or more configuration:

page_A4 = registry.Attachment.WkHtml2Pdf.Page.insert(
    label="A4", size="A4")
page_postal_label = registry.Attachment.WkHtml2Pdf.Page.insert(
    label="Postal carrier 1", height=80, width=120)
wkhtml2pdf = registry.Attachment.WkHtml2Pdf.insert(
    label="A4", page=page_A4, margin_top=20)
template = registry.Attachment.Template.insert(
    ...,
    wkhtml2pdf_configuration=wkhtml2pdf
)
doc = registry.Attachment.Document.insert(
    template=template, data=...)
doc.get_file()

API doc

Models

class anyblok_attachment.bloks.wkhtml2pdf.model.WkHtml2Pdf

Bases: object

Declaration type:
 Model
Registry name:Model.Attachment.WkHtml2Pdf
Tablename:attachment_wkhtml2pdf
Inherit model or mixin:
 
field name Description
created_at
  • Field type - <class
‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - False
  • nullable - False
  • Context:
orientation
  • Field type - <class
‘anyblok.column.Selection’>
  • Label - None
  • default - Portrait
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections:
  • Landscape - Landscape
  • Portrait - Portrait
  • size - 64
  • nullable - False
copies
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 1
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
margin_top
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 10
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
margin_bottom
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 10
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
load_error_handling
  • Field type - <class
‘anyblok.column.Selection’>
  • Label - None
  • default - abort
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections - get_error_handling
  • size - 64
  • nullable - False
background
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - True
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
page
  • Field type - <class
‘anyblok.relationship.Many2One’>
  • primary_key - False
  • Label - None
  • info:
  • index - False
  • remote_model -
Model.Attachment.WkHtml2Pdf.Page
  • nullable - False
  • unique - False
  • primary_key - False
  • _remote_columns - None
  • index - False
  • Context:
  • model - Model.Attachment.WkHtml2Pdf.Page
  • _column_names - None
  • unique - False
javascript
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - True
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
margin_left
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 10
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
javascript_delay
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 200
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
encoding
  • Field type - <class
‘anyblok.column.String’>
  • Label - None
  • default - utf-8
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • nullable - False
id
  • Field type - <class
‘anyblok.column.Integer’>
  • primary_key - True
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • nullable - False
  • DB column name - None
  • Context:
  • is crypted - False
  • autoincrement - True
  • foreign_key - None
label
  • Field type - <class
‘anyblok.column.String’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • nullable - False
dpi
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
page_offset
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 0
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
images
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - True
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
collate
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - True
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
local_file_access
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - True
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
updated_at
  • Field type - <class
‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - True
  • nullable - False
  • Context:
grayscale
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - False
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
margin_right
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - 10
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • nullable - False
minimu_font_size
  • Field type - <class
‘anyblok.column.Integer’>
  • Label - None
  • default - <class
‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
load_media_error_handling
  • Field type - <class
‘anyblok.column.Selection’>
  • Label - None
  • default - abort
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections - get_error_handling
  • size - 64
  • nullable - False
lowquality
  • Field type - <class
‘anyblok.column.Boolean’>
  • Label - None
  • default - False
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
cast_html2pdf(prefix, html_content)

Cast html document to a pdf document

Parameters:
  • prefix – prefix use for the tempory document
  • html_content – html file (bytes)
Return type:

bytes

Exception:

WkHtml2PdfException

class anyblok_attachment.bloks.wkhtml2pdf.model.Page

Bases: object

Define the Page size

Declaration type:
 Model
Registry name:Model.Attachment.WkHtml2Pdf.Page
Tablename:attachment_wkhtml2pdf_page
Inherit model or mixin:
 
field name Description
created_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - False
  • nullable - False
  • Context:
height
  • Field type - <class ‘anyblok.column.Integer’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
label
  • Field type - <class ‘anyblok.column.String’>
  • primary_key - True
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • nullable - False
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • foreign_key - None
width
  • Field type - <class ‘anyblok.column.Integer’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
size
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
updated_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - True
  • nullable - False
  • Context:

Mixins

class anyblok_attachment.bloks.wkhtml2pdf.mixin.WkHtml2Pdf

Bases: object

Declaration type:
 Mixin
Inherit model or mixin:
 
field name Description
wkhtml2pdf_configuration
  • Field type - <class
‘anyblok.relationship.Many2One’>
  • primary_key - False
  • Label - None
  • info:
  • index - False
  • remote_model -
Model.Attachment.WkHtml2Pdf
  • nullable - False
  • unique - False
  • primary_key - False
  • _remote_columns - None
  • index - False
  • Context:
  • model - Model.Attachment.WkHtml2Pdf
  • _column_names - None
  • unique - False
check_if_file_must_be_generated(document)

Overwrite to check also if the configuration have changed

Exceptions

exception anyblok_attachment.bloks.wkhtml2pdf.exceptions.WkHtml2PdfException

Only id the page configuration is wrong

exception anyblok_attachment.bloks.wkhtml2pdf.exceptions.PageValidityException

Only id the page configuration is wrong

Blok report

class anyblok_attachment.bloks.report.ReportBlok(registry)

Bases: anyblok.blok.Blok

Add attachment in AnyBlok

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
classmethod import_declaration_module()
name = 'report'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['attachment']
required_by = ['report-format']
version = '1.0.0'

Memento

The main goal is to create document in function of template

Add a new template:

template = registry.Attachment.Template.insert(...)

Add a Document without file but with a Template:

document = registry.Attachment.Document.insert(template=template, ...)
document.generate_file()

Warning

the get_file method may re-create the document with historization if the data have been changed

Model.Attachment.Parser

It is an unSQL model, the goal is to transform the data from Model.Attachment.Document to Json format to create the file:

@register(Model.Attachment.Parser)
class MyParser(Model.Attachment.Parser):

    @classmethod
    def serialize(cls, data):
        # return serialize data

    @classmethod
    def check_if_file_must_be_generated(cls, template, document):
        # return a Boolean to know if the file must be regenerate

Model.Attachment.Template

The template describe how to generate the document file in function of of the data in the document.

The Model.Attachment.Template can be used directly an Template type class must be add with polymorphism:

@register(Model.Attachment)
class Template:

    def get_template_type(self):
        res = super(MyTemplateType, self).get_template_type()
        res.update({'MyTemplateType': 'My type label'})
        return res


@register(Model.Attachment.Template)
class MyTemplateType(Model.Attachment.Template):
    TYPE = 'MyTypeOfTemplate'

    uuid = UUID(primary_key=True, nullable=False, binary=False,
                foreign_key=Model.Attachment.Template.use('uuid').options(ondelete='cascade'))
    # other field need for the template

    def render(self):
        # generate a file
        return file

or on the same table:

@register(Model.Attachment)
class Template:

    def get_template_type(self):
        res = super(MyTemplateType, self).get_template_type()
        res.update({'MyTemplateType': 'My type label'})
        return res


@register(Model.Attachment.Template,
          tablename=Model.Attachment.Template)
class MyTemplateType(Model.Attachment.Template):
    TYPE = 'MyTypeOfTemplate'

    def render(self):
        # generate a file
        return file

API doc

Common

anyblok_attachment.bloks.report.common.format_path(path)

Return the absolute path in function of the blok

Parameters:path – the path to format
Returns:the absolute path
Exception:PathException

Parser

class anyblok_attachment.bloks.report.parser.Parser(model)

Bases: object

Base parser to serialize the data for templating

Declaration type:
 Model
Registry name:Model.Attachment.Parser
Tablename:attachment_parser
Inherit model or mixin:
 
classmethod check_if_file_must_be_generated(template, document)

Return a boolean to know if the file must be generate or not

Parameters:
  • template – template intance
  • document – latest document instance
Returns:

bool

classmethod serialize(model, data)

Serialize the data to be understanding by template

Parameters:
  • model – an anyblok model need to serialize
  • data – json dict
Returns:

json dict

Template

class anyblok_attachment.bloks.report.template.Template

Bases: object

Base Model template to define the main configuration between templating system

Declaration type:
 Model
Registry name:Model.Attachment.Template
Tablename:attachment_template
Inherit model or mixin:
 
field name Description
created_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - False
  • nullable - False
  • Context:
parser_from
  • Field type - <class ‘anyblok.column.Selection’>
  • Label - None
  • default - model
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections - get_parser_from
  • size - 64
  • nullable - False
parser_model
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - Model.Attachment.Parser
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
filename
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - {doc.uuid}-{doc.version}-{date}
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • nullable - False
type
  • Field type - <class ‘anyblok.column.Selection’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections - get_template_type
  • size - 64
  • nullable - False
template_path
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
model
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - Model.System.Model => name
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • nullable - False
updated_at
  • Field type - <class ‘anyblok.column.DateTime’>
  • Label - None
  • is auto updated - True
  • nullable - False
  • Context:
uuid
  • Field type - <class ‘anyblok.column.UUID’>
  • primary_key - True
  • Label - None
  • default - <function uuid1 at 0x7f7d47bee488>
  • nullable - False
  • DB column name - None
  • Context:
  • is crypted - False
  • foreign_key - None
template_from
  • Field type - <class ‘anyblok.column.Selection’>
  • Label - None
  • default - path
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • selections - get_template_from
  • size - 64
  • nullable - False
check_if_file_must_be_generated(document)

Return True if the file must generate

Parameters:document – attachment document instance
Return type:bool
create_file_for(document)

Create a file and add it in the attachment document

Parameters:document – attachment document instance
get_parser()

return the template file to compute

classmethod get_parser_from()

Give the location of the parser

get_template()

return the template file to compute

classmethod get_template_from()

Give the location of the template

classmethod get_template_type()

Give the tempate type

render(data)

Return the file create by the templating engine

Parameters:data – the serialized data
update_document(document, file_, data)

Update the document to fill file and content

Parameters:
  • document – attachment document instance
  • file – bytes file
  • data – serialized data

Document

class anyblok_attachment.bloks.report.document.Document

Bases: object

Declaration type:
 Model
Registry name:Model.Attachment.Document
Tablename:attachment_document
Inherit model or mixin:
 
field name Description
template
  • Field type - <class ‘anyblok.relationship.Many2One’>
  • primary_key - False
  • Label - None
  • info:
  • primary_key - False
  • remote_model - Model.Attachment.Template
  • index - False
  • unique - False
  • _remote_columns - None
  • index - False
  • Context:
  • model - Model.Attachment.Template
  • _column_names - None
  • unique - False
class anyblok_attachment.bloks.report.document.Latest

Bases: object

Declaration type:
 Model
Registry name:Model.Attachment.Document.Latest
Tablename:attachment_document
Inherit model or mixin:
 

Exceptions

exception anyblok_attachment.bloks.report.exceptions.TemplateException

Simple exception if miss Template data

exception anyblok_attachment.bloks.report.exceptions.PathException

Simple exception if it is not a valid path for Template

exception anyblok_attachment.bloks.report.exceptions.RenderException

Simple exception for all error in the render method

Blok report-format

class anyblok_attachment.bloks.format.ReportBlok(registry)

Bases: anyblok.blok.Blok

Add attachment in AnyBlok

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
classmethod import_declaration_module()
name = 'report-format'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['report']
required_by = []
version = '1.0.0'

Memento

Simple python templating formatage

template file exemple:

<!doctype html>
<html>
    <head>
        <title>{title}</title>
    </head>
    <body>
        {description}
    </body>
</html>

add the documment and create file:

template = registry.Attachment.Template.Format.insert(
    template_path='path/of/the/python.template',
    contenttype='text/html',
    filename='mypage.html')
document = registry.Attachment.Document.insert(
    template=template,
    data={'title': 'My page', 'description': 'Hello world !!'}
)
document.get_file()

>>>:

{
    'contenttype': 'text/html',
    'file': b'<!doctype html>\n<html>\n    <head>\n        <title>My page</title>'
            b'\n    </head>\n    <body>\n        Hello world !!\n    </body>\n<'
            b'/html>\n',
    'file_added_at': datetime.datetime(2018, 1, 4, 9, 22, 56, 922346, tzinfo=<DstTzInfo 'CET' CET+1:00:00 STD>),
    'filename': 'mypage.html',
    'filesize': 131,
    'hash': b'\xf0\xe2?\xebk\xb4\x15\x0f\xb2\x9cT\x08\xee#\x02\xe2\xbe\xa16\x8d'
            b'\xc8\xcda\x91;\xba2\x9c\x9dUF\x10'}

}

API doc

Template

class anyblok_attachment.bloks.format.template.Template

Bases: object

Declaration type:
 Model
Registry name:Model.Attachment.Template
Tablename:attachment_template
Inherit model or mixin:
 

Format

class anyblok_attachment.bloks.format.template.Format

Bases: anyblok.model.Template

Simple python format templating

Declaration type:
 

Model

Registry name:

Model.Attachment.Template.Format

Tablename:

attachment_template_format

Inherit model or mixin:
 
  • <class ‘anyblok.model.Template’>
field name Description
contenttype
  • Field type - <class ‘anyblok.column.String’>
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • foreign_key - None
  • DB column name - None
  • Context:
  • is crypted - False
  • size - 64
  • nullable - False
uuid
  • Field type - <class ‘anyblok.column.UUID’>
  • primary_key - True
  • Label - None
  • default - <class ‘anyblok.column.NoDefaultValue’>
  • nullable - False
  • DB column name - None
  • Context:
  • is crypted - False
  • foreign_key - Model.Attachment.Template => uuid