def format_profile(self, request, obj, fieldname, *args, **kwargs): """IF user has a profile page return a link to it""" existing_profile = current_app.db.index.find_one( {'content_type': 'block', 'slug': slugify(obj.get('fullname'))} ) if existing_profile: edit_url = url_for( 'quokka.core.content.admin.blockview.edit_view', id=existing_profile['_id'] ) view_url = url_for( 'quokka.core.content.author', author=existing_profile['slug'] ) edit_link = html.a(href=edit_url, target='_blank')( html.i(class_="icon fa fa-pencil glyphicon glyphicon-pencil", style="margin-right: 5px;")(), 'Edit Profile' ) view_link = html.a(href=view_url, target='_blank')( html.i(class_="icon fa fa-globe glyphicon glyphicon-globe", style="margin-right: 5px;")(), 'View Profile' ) return html.div()( html.span()(edit_link), Markup(' '), html.span()(view_link) )
def format_datetime(self, request, obj, fieldname, *args, **kwargs): """Returns the formated datetime in string from object""" model = make_model(obj) return html.div(style='min-width:130px;')( getattr(model, fieldname).strftime( app.config.get('ADMIN_DATE_FORMAT', '%Y-%m-%d') ) )
def site_body(): return html.has_block('container')( html.div(class_='container')( html.block('container'), html.block('undefined'), html.has_block('noblock')( html.p() ) ) )
def format_datetime(self, request, obj, fieldname, *args, **kwargs): return html.div(style='min-width:130px;')( getattr(obj, fieldname).strftime(self.get_datetime_format()) )
def format_datetime(self, request, obj, fieldname, *args, **kwargs): return html.div(style='min-width:130px;')(getattr(obj, fieldname).strftime( self.get_datetime_format()))
def view_a(): html.block('container')( html.div('Container content.') ) return render_template()
def view_a_container(): return html.div('Container content.')
def view_a_body(): return html.div(class_='container')(g.blocks['container'])
def container_body(): return html.div('Container content.')
def site_body(): return html.div(class_='container')(g.blocks['container'])
def test_newline(): assert render([html.p('First'), html.newline(), html.p('Second')]) == '<p>First</p>\n\n<p>Second</p>\n' assert render(html.div(html.p('First'), html.newline(), html.p('Second'))) == \ '<div>\n <p>First</p>\n \n <p>Second</p>\n</div>\n' assert rn([html.p('First'), html.newline(), html.p('Second')]) == '<p>First</p><p>Second</p>'