Example #1
0
 def commit_preview(self, commit):
     res = []
     for owner in commit.tracker.owners:
         if hasattr(owner, 'get_action_links'):
             for link in owner.get_action_links(commit.root_node):
                 res.append(format_html('<a href="{url}">{text}</a>', **link))
     return ' '.join(res)
Example #2
0
    def approve_selected(self, request, queryset):
        for c in queryset:
            c.approve(request.user)

        commit_count = queryset.count()

        message = ungettext(
            '%d commit has been approved.',
            '%d commits have been approved.',
            commit_count
        ) % (commit_count,)

        from .forms import UndoApprovalsForm
        if HTML_IN_MESSAGES:
            message = format_html(
                '{0} {1}',
                message,
                UndoApprovalsForm(
                    initial={
                        'actions': [c.pk for c in queryset],
                        'referer': request.path,
                    }
                ).render(request, self.get_site())
            )

        messages.info(request, message, extra_tags='safe')
Example #3
0
 def commit_preview(self, commit):
     res = []
     for owner in commit.tracker.owners:
         if hasattr(owner, 'get_action_links'):
             for link in owner.get_action_links(commit.root_node):
                 res.append(
                     format_html('<a href="{url}">{text}</a>', **link))
     return ' '.join(res)
Example #4
0
    def get_message(self, commit, history_url):
        # XXX: Avoid circular import
        from .admin import HTML_IN_MESSAGES

        message = _('Commit %s has been approved') % commit
        if HTML_IN_MESSAGES:
            message = format_html('{0} {1}',
                message,
                UndoApprovalsForm(
                    initial={
                        'actions': [commit.pk],
                        'referer': history_url,
                    }
                ).render(self.request, self.site)
            )
        return message
Example #5
0
    def approve_selected(self, request, queryset):
        for c in queryset:
            c.approve(request.user)

        commit_count = queryset.count()

        message = ungettext('%d commit has been approved.',
                            '%d commits have been approved.',
                            commit_count) % (commit_count, )

        from .forms import UndoApprovalsForm
        if HTML_IN_MESSAGES:
            message = format_html(
                '{0} {1}', message,
                UndoApprovalsForm(initial={
                    'actions': [c.pk for c in queryset],
                    'referer': request.path,
                }).render(request, self.get_site()))

        messages.info(request, message, extra_tags='safe')
Example #6
0
 def tag(self):
     tag = super(ContentTypeRadioInput, self).tag()
     ct = ContentType.objects.get_for_id(self.choice_value)
     return format_html('<div class="previewImage {0} {1}"></div>{2}', ct.app_label, ct.model, tag)
Example #7
0
 def __init__(self, name, value, attrs, choice, index):
     super(ContentTypeRadioInput, self).__init__(name, value, attrs, choice, index)
     self.choice_label = format_html('<span class="label">{0}</span>', self.choice_label)
Example #8
0
 def render(self, *args, **kwargs):
     return format_html(u'<span>{name}</span>', name=self.display_name)
Example #9
0
 def label_from_instance(self, obj):
     url = reverse('widgy.contrib.widgy_mezzanine.views.preview',
                   kwargs={'node_pk': obj.working_copy.pk})
     return format_html('<a href="{url}">{preview}</a>',
                        url=url,
                        preview=ugettext('preview'))
Example #10
0
 def label_from_instance(self, obj):
     url = reverse('widgy.contrib.widgy_mezzanine.views.preview',
                   kwargs={'node_pk': obj.working_copy.pk})
     return format_html('<a href="{url}">{preview}</a>', url=url, preview=ugettext('preview'))
Example #11
0
 def tag(self):
     tag = super(ContentTypeRadioInput, self).tag()
     ct = ContentType.objects.get_for_id(self.choice_value)
     return format_html('<div class="previewImage {0} {1}"></div>{2}',
                        ct.app_label, ct.model, tag)
Example #12
0
 def __init__(self, name, value, attrs, choice, index):
     super(ContentTypeRadioInput, self).__init__(name, value, attrs, choice,
                                                 index)
     self.choice_label = format_html('<span class="label">{0}</span>',
                                     self.choice_label)
Example #13
0
 def render(self, *args, **kwargs):
     return format_html(u'<span>{name}</span>', name=self.display_name)