How to use the atelier.utils.i2t function in atelier

To help you get started, we’ve selected a few atelier 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 / comments / fixtures / demo2.py View on Github external
def objects():
    Comment = rt.models.comments.Comment
    User = rt.models.users.User
    Comment.auto_touch = False
    TXT = Cycler([styled, table, lorem, short_lorem, breaking, cond_comment,
                  plain1, plain2])
    for model in rt.models_by_base(Commentable):
        OWNERS = Cycler(model.objects.all())
        if len(OWNERS) == 0:
            return

        now = datetime.datetime.combine(dd.today(-30), i2t(822))
        if settings.USE_TZ:
            now = make_aware(now)
        DELTA = datetime.timedelta(minutes=34)

        owner = OWNERS.pop()
        for i in range(12):
            for u in User.objects.all():
                ses = BaseRequest(user=u)
                # if owner.private:
                #     txt = "<p>Confidential comment</p>"
                # else:
                #     txt = TXT.pop() # txt = "Hackerish comment"
                obj = Comment(user=u, owner=owner, body=TXT.pop())
                obj.on_create(ses)
                obj.after_ui_create(ses)
                obj.before_ui_save(ses)
github lino-framework / lino / lino / modlib / notify / fixtures / demo.py View on Github external
def objects():
    ar = rt.login('robin')
    now = datetime.datetime.combine(dd.today(), i2t(548))
    for u in rt.models.users.User.objects.all():
        yield rt.models.notify.Message.create_message(
            ar, u, subject="Database initialized",
            created=now,
            body="Hello world", sent=now)
github lino-framework / lino / lino / modlib / notify / fixtures / demo2.py View on Github external
def objects():
    now = datetime.datetime.combine(dd.today(), i2t(548))
    if settings.USE_TZ:
        now = make_aware(now)
    mt = rt.models.notify.MessageTypes.system
    for u in rt.models.users.User.objects.order_by('username'):
        # if u.user_type.has_required_roles()
        with translation.override(u.language):
            yield rt.models.notify.Message.create_message(
                u, subject=_("The database has been initialized."),
                mail_mode=u.mail_mode, created=now, message_type=mt,
                sent=now)