How to use the django.utils.translation.ugettext_lazy function in Django

To help you get started, we’ve selected a few Django 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 galotecnia / SingularMS / singularms / web / apps / addressbook / models.py View on Github external
def direccion_form(self):
        from forms import DynamicForm
        kwargs = SortedDict()
        for dir in self.direccion_set.all():
            kwargs['%d_tip' % dir.id] = forms.ChoiceField(choices=OPCIONES_DIRECCION, label=_(u'Type'), initial=dir.tipo)
            kwargs['%d_dom' % dir.id] = forms.CharField(required=False, max_length = 100, label=_(u'Address'), initial=dir.domicilio)
            kwargs['%d_cod' % dir.id] = forms.CharField(required=False, max_length = 5, label=_(u'Post Code'), initial=dir.codPostal)
            kwargs['%d_pob' % dir.id] = forms.CharField(required=False, max_length = 50, label=_(u'City'), initial=dir.poblacion)
            kwargs['%d_pro' % dir.id] = forms.CharField(required=False, max_length = 50, label=_(u'Province'), initial=dir.provincia)
            kwargs['%d_pai' % dir.id] = forms.CharField(required=False, max_length = 50, label=_(u'Country'), initial=dir.pais)
            kwargs['%d_del' % dir.id] = forms.BooleanField(required=False, initial=False, label=_(u'Delete?'))
        form = DynamicForm()
        form.setFields(kwargs)
        return form
github mayan-edms / Mayan-EDMS / apps / documents / conf / settings.py View on Github external
{'name': u'UUID_FUNCTION', 'global_name': u'DOCUMENTS_UUID_FUNCTION', 'default': default_uuid},
        # Storage
        {'name': u'STORAGE_BACKEND', 'global_name': u'DOCUMENTS_STORAGE_BACKEND', 'default': FileBasedStorage},
        # Transformations
        {'name': u'AVAILABLE_TRANSFORMATIONS', 'global_name': u'DOCUMENTS_AVAILABLE_TRANSFORMATIONS', 'default': available_transformations},
        {'name': u'DEFAULT_TRANSFORMATIONS', 'global_name': u'DOCUMENTS_DEFAULT_TRANSFORMATIONS', 'default': []},
        # Usage
        {'name': u'PREVIEW_SIZE', 'global_name': u'DOCUMENTS_PREVIEW_SIZE', 'default': u'640x480'},
        {'name': u'PRINT_SIZE', 'global_name': u'DOCUMENTS_PRINT_SIZE', 'default': u'1400'},
        {'name': u'MULTIPAGE_PREVIEW_SIZE', 'global_name': u'DOCUMENTS_MULTIPAGE_PREVIEW_SIZE', 'default': u'160x120'},
        {'name': u'THUMBNAIL_SIZE', 'global_name': u'DOCUMENTS_THUMBNAIL_SIZE', 'default': u'50x50'},
        {'name': u'DISPLAY_SIZE', 'global_name': u'DOCUMENTS_DISPLAY_SIZE', 'default': u'1200'},
        {'name': u'RECENT_COUNT', 'global_name': u'DOCUMENTS_RECENT_COUNT', 'default': 40, 'description': _(u'Maximum number of recent (created, edited, viewed) documents to remember per user.')},
        {'name': u'ZOOM_PERCENT_STEP', 'global_name': u'DOCUMENTS_ZOOM_PERCENT_STEP', 'default': 50, 'description': _(u'Amount in percent zoom in or out a document page per user interaction.')},
        {'name': u'ZOOM_MAX_LEVEL', 'global_name': u'DOCUMENTS_ZOOM_MAX_LEVEL', 'default': 200, 'description': _(u'Maximum amount in percent (%) to allow user to zoom in a document page interactively.')},
        {'name': u'ZOOM_MIN_LEVEL', 'global_name': u'DOCUMENTS_ZOOM_MIN_LEVEL', 'default': 50, 'description': _(u'Minimum amount in percent (%) to allow user to zoom out a document page interactively.')},
        {'name': u'ROTATION_STEP', 'global_name': u'DOCUMENTS_ROTATION_STEP', 'default': 90, 'description': _(u'Amount in degrees to rotate a document page per user interaction.')},
    ]
github allegro / ralph / src / ralph / discovery / models_component.py View on Github external
)
    full = db.BooleanField(default=True)

    class Meta:
        verbose_name = _("disk share")
        verbose_name_plural = _("disk shares")

    def __unicode__(self):
        return '%s (%s)' % (self.label, self.wwn)

    def get_total_size(self):
        return (self.size or 0) + (self.snapshot_size or 0)


class DiskShareMount(TimeTrackable, WithConcurrentGetOrCreate):
    share = db.ForeignKey(DiskShare, verbose_name=_("share"))
    device = db.ForeignKey('Device', verbose_name=_("device"), null=True,
                           blank=True, default=None, on_delete=db.SET_NULL)
    volume = db.CharField(verbose_name=_("volume"),
                          max_length=255, blank=True,
                          null=True, default=None)
    server = db.ForeignKey(
        'Device', verbose_name=_("server"), null=True, blank=True,
        default=None, related_name='servermount_set',
    )
    size = db.PositiveIntegerField(
        verbose_name=_("size (MiB)"), null=True, blank=True,
    )
    address = db.ForeignKey("IPAddress", null=True, blank=True, default=None)
    is_virtual = db.BooleanField(
        verbose_name=_("is that a virtual server mount?"), default=False,
    )
github lino-framework / lino / lino_noi / lib / noi / help_texts.py View on Github external
'lino_noi.lib.tickets.models.Ticket' : _("""A Ticket is a concrete question or problem formulated by a
reporter (a user)."""),
    'lino_noi.lib.tickets.models.Ticket.reporter' : _("""The user who reported this ticket."""),
    'lino_noi.lib.tickets.models.Ticket.assigned_to' : _("""The user who is working on this ticket."""),
    'lino_noi.lib.tickets.models.Ticket.state' : _("""The state of this ticket. See TicketStates"""),
    'lino_noi.lib.tickets.models.Ticket.waiting_for' : _("""What to do next. An unformatted one-line text which describes
what this ticket is waiting for."""),
    'lino_noi.lib.tickets.models.Ticket.upgrade_notes' : _("""A formatted text field meant for writing instructions for the
hoster's site administrator when doing an upgrade where this
ticket is being deployed."""),
    'lino_noi.lib.tickets.models.Ticket.description' : _("""A complete and concise description of the ticket. This should
describe in more detail what this ticket is about. If the
ticket has evolved during time, it should reflect the latest
version."""),
    'lino_noi.lib.tickets.models.Ticket.duplicate_of' : _("""A pointer to the ticket which is the cause of this ticket."""),
    'lino_noi.lib.tickets.models.Ticket.deadline' : _("""Specify that the ticket must be done for a given date."""),
    'lino_noi.lib.tickets.models.Ticket.priority' : _("""How urgent this ticket is. This should be a value between 0
and 100."""),
    'lino_noi.lib.tickets.roles.Triager' : _("""A user who is responsible for triaging new tickets."""),
    'lino_noi.lib.tickets.ui.ActiveProjects' : _("""Show a list of active projects."""),
    'lino_noi.lib.tickets.ui.ActiveProjects.model' : _("""alias of Project"""),
    'lino_noi.lib.tickets.ui.Tickets' : _("""Global list of all tickets."""),
    'lino_noi.lib.tickets.ui.Tickets.site' : _("""Select a site if you want to see only tickets for this site."""),
    'lino_noi.lib.tickets.ui.Tickets.show_private' : _("""Show only (or hide) tickets that are marked private."""),
    'lino_noi.lib.tickets.ui.Tickets.show_active' : _("""Show only (or hide) tickets which are active (i.e. state is Talk
or ToDo)."""),
    'lino_noi.lib.tickets.ui.Tickets.show_assigned' : _("""Show only (or hide) tickets which are assigned to somebody."""),
    'lino_noi.lib.tickets.ui.Tickets.has_project' : _("""Show only (or hide) tickets which have a project assigned."""),
    'lino_noi.lib.tickets.ui.Tickets.feasable_by' : _("""Show only tickets for which I am competent."""),
    'lino_noi.lib.tickets.ui.Tickets.model' : _("""alias of Ticket"""),
    'lino_noi.lib.tickets.ui.DuplicatesByTicket' : _("""Shows the tickets which are marked as duplicates of this
(i.e. whose duplicate_of field points to this ticket."""),
github mayan-edms / Mayan-EDMS / mayan / apps / history / views.py View on Github external
def history_for_object(request, app_label, module_name, object_id):
    model = get_model(app_label, module_name)
    if not model:
        raise Http404
    content_object = get_object_or_404(model, pk=object_id)
    content_type = ContentType.objects.get_for_model(model)

    try:
        Permission.objects.check_permissions(request.user, [PERMISSION_HISTORY_VIEW])
    except PermissionDenied:
        AccessEntry.objects.check_access(PERMISSION_HISTORY_VIEW, request.user, content_object)

    context = {
        'object_list': History.objects.filter(content_type=content_type, object_id=object_id),
        'title': _(u'history events for: %s') % content_object,
        'object': content_object,
        'hide_object': True,
    }

    return render_to_response('generic_list.html', context,
        context_instance=RequestContext(request))
github matagus / django-planet / planet / models.py View on Github external
@python_2_unicode_compatible
class Feed(models.Model):
    """
    A model to store detailed info about a parsed Atom or RSS feed
    """
    # a feed belongs to a blog
    blog = models.ForeignKey("planet.Blog", null=True, blank=True)
    # a site where this feed is published
    site = models.ForeignKey(Site, null=True, blank=True, db_index=True)
    # url to retrieve this feed
    url = models.URLField(_("Url"), unique=True, db_index=True)
    # title attribute from Feedparser's Feed object
    title = models.CharField(_("Title"), max_length=255, db_index=True,
        blank=True, null=True)
    # subtitle attribute from Feedparser's Feed object. aka tagline
    subtitle = models.TextField(_("Subtitle"), blank=True, null=True)
    # rights or license attribute from Feedparser's Feed object
    rights = models.CharField(_("Rights"), max_length=255, blank=True,
                              null=True)
    # generator_detail attribute from Feedparser's Feed object
    generator = models.ForeignKey("planet.Generator", blank=True, null=True)
    # info attribute from Feedparser's Feed object
    info = models.CharField(_("Infos"), max_length=255, blank=True, null=True)
    # language name or code. language attribute from Feedparser's Feed object
    language = models.CharField(_("Language"), max_length=50, blank=True,
                                null=True)
    # global unique identifier for the feed
    guid = models.CharField(_("Global Unique Identifier"), max_length=32,
        blank=True, null=True, db_index=True)
    # icon attribute from Feedparser's Feed object
    icon_url = models.URLField(_("Icon URL"), blank=True, null=True)
    # image attribute from Feedparser's Feed object
github karpenoktem / kninfra / kn / leden / urls.py View on Github external
url(_(r'^ik/settings$'), views.ik_settings, name="ik-settings"),
    url(_(r'^ik/smoel$'), views.ik_chsmoel, name="ik-chsmoel"),
    url(_(r'^api/?$'), api.view, name='leden-api'),
    url(_(r'^secretariaat/inschrijven$'),
        views.secr_add_user, name='secr-add-user'),
    url(_(r'^secretariaat/update-site-agenda/$'),
        views.secr_update_site_agenda, name='secr-update-site-agenda'),
    url(_(r'^secretariaat/addgroup$'),
        views.secr_add_group, name='secr-add-group'),
    url(_(r'^secretariaat/notes$'),
        views.secr_notes, name='secr-notes'),
    url(_(r'^fiscus/email-debitors$'),
        views.fiscus_debtmail, name='fiscus-debtmail'),
    url(_(r'^boekenlezers/presentielijst$'),
        views.boekenlezers_name_check, name='bl-namecheck'),
    url(_(r'^fin$'), views.fins, name="fins"),
    url(_(r'^fin(?P\d+)$'), views.fin_overview, name="fin"),
    url(_(r'^fin(?P\d+)/errors$'),
        views.fin_errors, name="fin-errors"),
    url(_(r'^fin(?P\d+)/show/(?P.*)$'),
        views.fin_show, name="fin-show"),
    url(_(r'^relaties/(?P<_id>[^/]+)/beindig$'),
        views.relation_end, name='relation-end'),
    url(_(r'^relaties/begin$'),
        views.relation_begin, name='relation-begin'),
    url(_(r'^tags/tag$'),
        views.tag, name='tag'),
    url(_(r'^tags/untag$'),
        views.untag, name='untag'),
    url(_(r'^noteer$'),
        views.note_add, name='add-note'),
github neuromat / nes / patientregistrationsystem / qdc / patient / models.py View on Github external
('TR', _('Turkey')),
        ('TM', _('Turkmenistan')),
        ('TC', _('Turks & Caicos Islands')),
        ('TV', _('Tuvalu')),
        ('UG', _('Uganda')),
        ('UA', _('Ukraine')),
        ('AE', _('United Arab Emirates')),
        ('GB', _('United Kingdom (Great Britain)')),
        ('UM', _('United States Minor Outlying Islands')),
        ('US', _('United States of America')),
        ('VI', _('United States Virgin Islands')),
        ('UY', _('Uruguay')),
        ('UZ', _('Uzbekistan')),
        ('VU', _('Vanuatu')),
        ('VA', _('Vatican City State (Holy See)')),
        ('VE', _('Venezuela')),
        ('VN', _('Viet Nam')),
        ('WF', _('Wallis & Futuna Islands')),
        ('EH', _('Western Sahara')),
        ('YE', _('Yemen')),
        ('YU', _('Yugoslavia')),
        ('ZR', _('Zaire')),
        ('ZM', _('Zambia')),
        ('ZW', _('Zimbabwe')),
        ('ZZ', _('Unknown or unspecified country')),
    )


def validate_date_questionnaire_response(value):
    if value > datetime.date.today():
        raise ValidationError(_("Fill date can not be bigger than today's date."))
github django-danceschool / django-danceschool / danceschool / financial / cms_toolbars.py View on Github external
def populate(self):
        menu = None
        addBreak = False
        if self.request.user.has_perm('financial.add_expenseitem'):
            menu, newPosition = self.addTheMenu()
            menu.add_link_item(_('Submit Expenses'), url=reverse('submitExpenses'), position=newPosition)
            addBreak = True
        if self.request.user.has_perm('financial.add_revenueitem'):
            menu, newPosition = self.addTheMenu()
            menu.add_link_item(_('Submit Revenues'), url=reverse('submitRevenues'), position=newPosition)
            addBreak = True
        if hasattr(self.request.user,'staffmember') and self.request.user.staffmember and self.request.user.has_perm('core.view_own_instructor_finances'):
            menu, newPosition = self.addTheMenu()
            menu.add_link_item(_('Your Payment History'), url=reverse('staffMemberPayments'), position=newPosition)

        if addBreak:
            menu.add_break('post_submission_break', position=newPosition + 1)

        if self.request.user.has_perm('financial.view_finances_bymonth'):
            menu, newPosition = self.addTheMenu()
            menu.add_link_item(_('View Monthly Financial Summary'), url=reverse('financesByMonth'), position=newPosition)
        if self.request.user.has_perm('financial.view_finances_byevent'):
            menu, newPosition = self.addTheMenu()
            menu.add_link_item(_('View Financial Summary By Event'), url=reverse('financesByEvent'), position=newPosition)

        if self.request.user.has_perm('financial.view_finances_detail'):
github La0 / coach / coach / menu.py View on Github external
def _build_help():
    # Build help menu with contact & news
    submenu = {
      'caption' : _('Help'),
      'menu' : [],
      'icon' : 'icon-help-circled',
    }
    submenu['menu'].append(_ext(settings.HELP_URL, _('Help')))
    submenu['menu'].append(_p('vma-glossary', _('Glossary')))
    submenu['menu'].append(_p(('page-list', 'news'), _('News'), lazy=True))
    submenu['menu'].append(_p(('contact',), _('Contact'), lazy=True))
    return submenu