Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add renderer=None to Credential Widget #522

Open
Tauhid-Ahmed8009 opened this issue Jul 16, 2023 · 0 comments
Open

add renderer=None to Credential Widget #522

Tauhid-Ahmed8009 opened this issue Jul 16, 2023 · 0 comments

Comments

@Tauhid-Ahmed8009
Copy link

Tauhid-Ahmed8009 commented Jul 16, 2023

in jet/dashboard/dashboard_modules/google_analytics.py
add renderer=None

class CredentialWidget(Widget):
module = None

def render(self, name, value, attrs=None, **renderer=None**):
    if value and len(value) > 0:
        link = '<a href="%s">%s</a>' % (
            reverse('jet-dashboard:google-analytics-revoke', kwargs={'pk': self.module.model.pk}),
            force_str(_('Revoke access'))
        )
    else:
        link = '<a href="%s">%s</a>' % (
            reverse('jet-dashboard:google-analytics-grant', kwargs={'pk': self.module.model.pk}),
            force_str(_('Grant access'))
        )

    attrs = self.build_attrs({
        'type': 'hidden',
        'name': 'credential',
    })
    attrs['value'] = force_unicode(value) if value else ''

    return format_html('%s<input{} />' % link, flatatt(attrs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant