How to use the lino.api.dd function in lino

To help you get started, we’ve selected a few lino examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-framework / lino / lino / modlib / cal / View on Github external
def on_analyze(cls, lino):
        #~ lino.TASK_AUTO_FIELDS = dd.fields_list(cls,
        cls.DISABLED_AUTO_FIELDS = dd.fields_list(
            cls, """start_date start_time summary""")
        super(Task, cls).on_analyze(lino)
github lino-framework / lino / lino / modlib / publisher / View on Github external
    def is_published(cls, choice, ar):
        return choice.is_published
github lino-framework / lino / lino / modlib / forms / View on Github external
Database models for `lino.modlib.bootstrap3`.

.. autosummary::


from django.conf import settings
from lino.core.tables import AbstractTable
from django.utils.translation import ugettext_lazy as _

from lino.api import dd

class ShowAsHtml(dd.Action):
    label = _("HTML")
    help_text = _('Show this table in Bootstrap3 interface')
    icon_name = 'html'
    sort_index = -15
    select_rows = False
    default_format = 'ajax'
    preprocessor = "Lino.get_current_grid_config"
    callable_from = 't'

    # def is_callable_from(self, caller):
    #     return isinstance(caller, dd.ShowTable)

    def run_from_ui(self, ar, **kw):
        url = dd.plugins.bootstrap3.renderer.get_request_url(ar)
github lino-framework / lino / lino / modlib / pages / View on Github external
logger = logging.getLogger(__name__)

from django.conf import settings
from django.db import models

from lino.utils import AttrDict
# from lino.core import web
from lino.api import dd

from lino.utils.restify import restify
from lino.utils.restify import doc2rst


class DummyPage(AttrDict):
    raw_html = False
    #~ special = False

    def __str__(self):
        return u'%s %s' % (self._meta.verbose_name, self.ref)

    def get_sidebar_html(self, request):
        return ''

    def full_clean(self):

    def save(self):
github lino-framework / lino / lino / modlib / notes / View on Github external
def customize_siteconfig():
    Injects application-specific fields to :class:`SiteConfig `.
            blank=True, null=True,
            verbose_name=_("Default system note type"),
Note Type used by system notes.
github lino-framework / lino / lino / modlib / comments / View on Github external
from django.contrib.humanize.templatetags.humanize import naturaltime

from lino.api import dd, rt
from lino.modlib.users.mixins import My
from etgen.html import E, tostring
# from lxml import etree
import lxml
# from lino.utils.soup import truncate_comment
from lino.core.gfks import gfk2lookup
from .roles import CommentsReader, CommentsUser, CommentsStaff
from .choicelists import CommentEvents
from lino import mixins
from lino.core.constants import CHOICES_BLANK_FILTER_VALUE

class CommentTypes(dd.Table):
    required_roles = dd.login_required(CommentsStaff)
    model = 'comments.CommentType'
    column_names = "name *"
    order_by = ["name"]

    insert_layout = """

    detail_layout = """
    id name
github lino-framework / lino / lino / modlib / workflows / View on Github external
If this is empty, the permission applies for all workflow actions of the actor.
        state = models.CharField(
            _("State"), max_length=settings.SITE.max_state_value_length,
          Permission applies only for objects in the given state.
          If this is empty, the permission applies for all states.
        #~ state_after = models.CharField(_("State after"),max_length=20)
        user_level = dd.UserLevels.field(blank=True,
          If not empty, this permission applies only for users having at least the given level.
        # ~ user_groups = UserGroup.field(max_length=200,blank=True,force_selection=False) # TODO: multiple=True
        user_group = dd.UserGroups.field(
          If not empty, this permission applies only for members of the given group.
          """)  # TODO: multiple=True
        #~ user_groups = models.CharField(_("user groups"),max_length=200,blank=True)
        owned_only = models.BooleanField(_("owned only"), default=False,
          Allow this action only for objects owned by the user

        #~ def get_siblings(self):
            #~ "Overrides :meth:`lino.mixins.Sequenced.get_siblings`"
            #~ return self.__class__.objects.filter(actor_name=self.actor_name).order_by('seqno')

        def actor_name_choices(cls):
            #~ return WORKFLOWABLE_ACTORS.items()
github lino-framework / lino / lino / modlib / outbox / View on Github external
#~ detail_layout = """
    #~ mail owner
    #~ """

class AttachmentsByMail(Attachments):
    required_roles = dd.required(OfficeUser)
    master_key = 'mail'
    slave_grid_format = 'summary'

class AttachmentsByController(Attachments):
    master_key = 'owner'

dd.update_field(Mail, 'user', verbose_name=_("Sender"))
github lino-framework / lino / lino / modlib / gfks / View on Github external
  def my_pre_ui_build(sender, **kw):
        HelpText = rt.models.gfks.HelpText
        for ht in HelpText.objects.filter(help_text__isnull=False):
            #"20120629 %s.help_text", ht)
                dd.resolve_field(str(ht)).help_text = ht.help_text
            except FieldDoesNotExist as e:
                #~ logger.debug("No help texts : %s",e)
    except DatabaseError as e:
        dd.logger.debug("No help texts : %s", e)
github lino-framework / lino / lino / modlib / dashboard / View on Github external
def get_siblings(self):
        qs = super(Widget, self).get_siblings()
        return qs.filter(user=self.user)
    def title(self, ar):
        a = settings.SITE.models.resolve(self.item_name)
        # might be invalid e.g. if the widget was created by a
        # previous version.
        if a is None:
            return _("Invalid item_name {} in {}").format(
                self.item_name, self._meta.verbose_name)
        return a.label

class Widgets(dd.Table):
    model = 'dashboard.Widget'

class AllWidgets(Widgets):
    label = _("All dashboard widgets")
    required_roles = dd.login_required(SiteAdmin)
    column_names = 'id user seqno move_buttons title visible *'
    order_by = ['id']
class WidgetsByUser(Widgets):
    label = _("Dashboard")
    master_key = 'user'
    column_names = 'seqno move_buttons title visible *'
    order_by = ['seqno']

def update_widgets_for(ar, user):