How to use the lino.api._ 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_noi / lib / tickets / View on Github external
def param_defaults(self, ar, **kw):
        kw = super(ActiveProjects, self).param_defaults(ar, **kw)
        return kw

class ProjectsByParent(Projects):
    master_key = 'parent'
    label = _("Subprojects")
    column_names = "ref name children_summary *"

class TopLevelProjects(Projects):
    label = _("Projects (tree)")
    required_roles = dd.required(dd.SiteStaff)
    order_by = ["ref"]
    column_names = 'ref name parent children_summary *'
    filter = models.Q(parent__isnull=True)
    variable_row_height = True

class ProjectsByType(Projects):
    master_key = 'type'
    column_names = "ref name *"

class ProjectsByCompany(Projects):
    master_key = 'company'
    column_names = "ref name *"
github lino-framework / lino / lino_noi / lib / tickets / View on Github external
# required=dict(states=['new']),
    # action_name=_("Wait for feedback"),
    # help_text=_("Waiting for feedback from partner."))
add('40', _("Ready"), 'ready',
    # help_text=_(
    #     "Has been fixed. Ready for release. Waiting to be tested."),
    button_text="\u2610")  # BALLOT BOX
add('50', _("Done"), 'done',
    button_text="\u2611")  # BALLOT BOX WITH CHECK

# add('50', _("Tested"), 'tested',
#     # required=dict(states=['fixed']),
#     help_text=_("Has been fixed and tested."))
# add('60', _("Refused"), 'refused',
add('60', _("Cancelled"), 'cancelled',
    # required=dict(states="tested new todo callback"),
    # help_text=_("It has been decided that we won't fix this ticket."))
    button_text=u"đź—‘")  # WASTEBASKET (U+1F5D1)
# add('90', _("Cancelled"), 'cancelled',
#     # required=dict(states=['new todo waiting']),
#     help_text=_("Has been cancelled for some reason."))

"""Difference between Cancelled and Refused was that: Canceled means
that we don't want to talk about this ticket anymore.  Refused makes
sense for tickets which had been asked by a partner. In that case we
still may want to report it.

Also remember this thought: Should we add a new ticket state "dropped"
or "withdrawn" ("Verworfen", "Widerrufen") to indicate that the
*reporter* decided to cancel their plea? This is different from
"refused".  --> Solution seems to rename "refused" to "cancelled"
github lino-framework / lino / lino / modlib / dupable_partners / View on Github external
Database models for `lino.modlib.dupable_partners`.
from builtins import object

from lino.api import dd, _

from lino.mixins.dupable import PhoneticWordBase, SimilarObjects

class Word(PhoneticWordBase):
    """Phonetic words for Partners."""

    class Meta(object):
        verbose_name = _("Phonetic word")
        verbose_name_plural = _("Phonetic words")

    owner = dd.ForeignKey('contacts.Partner', related_name='dupable_words')

class Words(dd.Table):
    model = 'dupable_partners.Word'
    required_roles = dd.required(dd.SiteStaff)

class SimilarPartners(SimilarObjects):
    label = _("Similar partners")
github lino-framework / lino / lino / modlib / cal / View on Github external
def as_link(cls, ar, today, txt=None):
        if ar is None:
            return ''
        if today is None:
            today =
        if txt is None:
            txt = when_text(today)
        pv = dict(start_date=today)
        # TODO: what to do with events that span multiple days?
        target = ar.spawn(cls, param_values=pv)
        return ar.href_to_request(target, txt)

class ShowEventsByDay(dd.Action):
    label = _("Today")
    help_text = _("Show all calendar events of the same day.")
    show_in_bbar = True
    sort_index = 60
    icon_name = 'calendar'

    def __init__(self, date_field, **kw):
        self.date_field = date_field
        super(ShowEventsByDay, self).__init__(**kw)

    def run_from_ui(self, ar, **kw):
        obj = ar.selected_rows[0]
        today = getattr(obj, self.date_field)
        pv = dict(start_date=today)
        sar = ar.spawn(EventsByDay, param_values=pv)
        js = ar.renderer.request_handler(sar)
github lino-framework / lino / lino_noi / lib / tickets / View on Github external
start_date end_date observed_event topic feasable_by"""

    def param_defaults(self, ar, **kw):
        kw = super(TicketsToDo, self).param_defaults(ar, **kw)
        return kw

class ActiveTickets(Tickets):
    """Active tickets are those which are neither closed nor in standby

    label = _("Active tickets")
    required_roles = dd.login_required(Triager)
    order_by = ["-id"]
    # order_by = ["-modified", "id"]
    column_names = 'overview:50 topic:10 reporter:10 project:10 ' \
                   'assigned_to:10 ticket_type:10 workflow_buttons:40 *'

    def param_defaults(self, ar, **kw):
        kw = super(ActiveTickets, self).param_defaults(ar, **kw)
        # kw.update(
        # kw.update(
        return kw

class MyTickets(My, Tickets):
github lino-framework / lino / lino / modlib / cal / View on Github external
_("Event is an appointment"), default=True)
    all_rooms = models.BooleanField(_("Locks all rooms"), default=False)
    locks_user = models.BooleanField(
        _("Locks the user"),
            "Whether events of this type make the user unavailable "
            "for other locking events at the same time."),

    start_date = models.DateField(
        verbose_name=_("Start date"),
        blank=True, null=True)
    event_label = dd.BabelCharField(
        _("Event label"),
        max_length=200, blank=True,
        help_text=_("Default text for summary of new events."))
    # , default=_("Calendar entry"))
    # default values for a Babelfield don't work as expected

    max_conflicting = models.PositiveIntegerField(
        _("Simultaneous events"),
        help_text=_("How many conflicting events should be tolerated."),

    def __str__(self):
        # when selecting an Event.event_type it is more natural to
        # have the event_label. It seems that the current `name` field
        # is actually never used.
        return settings.SITE.babelattr(self, 'event_label') \
            or settings.SITE.babelattr(self, 'name')
github lino-framework / lino / lino / modlib / beid / View on Github external
- Johan: A document type of 7 is used for bootstrap cards ? What
      is a bootstrap card (maybe some kind of test card?)  Danny: A
      bootstrap card was an eID card that was used in the early start
      of the eID card introduction to bootstrap the computers at the
      administration. This type is no longer issued.
    - Johan: A document type of 8 is used for a
      "habilitation/machtigings" card ? Is this for refugees or asylum
      seekers? Danny: A habilitation/machtigings card was aimed at
      civil servants. This type is also no longer used.

    required_roles = dd.required(dd.SiteStaff)
    verbose_name = _("eID card type")
    verbose_name_plural = _("eID card types")

add = BeIdCardTypes.add_item
add('1', _("Belgian citizen"), "belgian_citizen")
# ,de=u"Belgischer StaatsbĂĽrger",fr=u"Citoyen belge"),
add('6', _("Kids card (< 12 year)"), "kids_card")
#,de=u"Kind unter 12 Jahren"),

#~ add('8', _("Habilitation"))

add('11', _("Foreigner card A"), "foreigner_a")
        #~ nl=u"Bewijs van inschrijving in het vreemdelingenregister - Tijdelijk verblijf",
        #~ fr=u"Certificat d'inscription au registre des Ă©trangers - SĂ©jour temporaire",
        #~ de=u"Ausländerkarte A Bescheinigung der Eintragung im Ausländerregister - Vorübergehender Aufenthalt",
add('12', _("Foreigner card B"), "foreigner_b")
github lino-framework / lino / lino / modlib / ipdict / View on Github external
    @dd.displayfield(_("Login failures"))
    def login_failures(self, obj, ar):
        return obj.login_failures
github lino-framework / lino / lino / modlib / tickets / View on Github external
'workflow_buttons:30 reporter:10 project:10 *'
    detail_layout = TicketDetail()
    insert_layout = """
    reporter #product

    detail_html_template = "tickets/Ticket/detail.html"

    parameters = mixins.ObservedPeriod(
            blank=True, null=True,
            help_text=_("Only rows reporter by this user.")),
            verbose_name=_("Assigned to"),
            blank=True, null=True,
            help_text=_("Only tickets assigned to this user.")),
            verbose_name=_("Interesting for"),
            blank=True, null=True,
            help_text=_("Only tickets interesting for this site.")),
            blank=True, null=True),
            blank=True, help_text=_("Only rows having this state.")),
github lino-framework / lino / lino / modlib / addresses / View on Github external
# Copyright 2014-2015 Luc Saffre
# License: BSD (see file COPYING for details)

from lino.api import dd, _
from import OfficeStaff

class AddressType(dd.Choice):
    living_text = _("living at")

class AddressTypes(dd.ChoiceList):
    required_roles = dd.login_required(OfficeStaff)
    verbose_name = _("Address type")
    verbose_name_plural = _("Address types")
    item_class = AddressType

add = AddressTypes.add_item
add('01', _("Official address"), 'official')  # IT020
add('02', _("Unverified address"), 'unverified')  # IT042
add('03', _("Declared address"), 'declared')  # IT214
add('04', _("Reference address"), 'reference')
add('98', _("Obsolete"), 'obsolete')
add('99', _("Other"), 'other')