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

Issue with google analytics widget #495

Open
SoftDevel97 opened this issue Nov 8, 2021 · 1 comment
Open

Issue with google analytics widget #495

SoftDevel97 opened this issue Nov 8, 2021 · 1 comment

Comments

@SoftDevel97
Copy link

SoftDevel97 commented Nov 8, 2021

Google analytics widget looks like this in admin page:

Cattura

When I press on the message, this error appears:

Cattura1

The error is in the file "venv/lib/site-packages/django/forms/boundfield.py", in the following function:

def as_widget(self, widget=None, attrs=None, only_initial=False):
        """
        Render the field by rendering the passed widget, adding any HTML
        attributes passed as attrs. If a widget isn't specified, use the
        field's default widget.
        """
        widget = widget or self.field.widget
        if self.field.localize:
            widget.is_localized = True
        attrs = attrs or {}
        attrs = self.build_widget_attrs(attrs, widget)
        if self.auto_id and 'id' not in widget.attrs:
            attrs.setdefault('id', self.html_initial_id if only_initial else self.auto_id)
        return widget.render(
            name=self.html_initial_name if only_initial else self.html_name,
            value=self.value(),
            attrs=attrs,
            renderer=self.form.renderer,
        )

where widget can be TextInput or Textarea from this:

from django.forms.widgets import Textarea, TextInput

However in the file "venv/lib/site-packages/django/forms/widgets.py" the widget class contains this render function which contains renderer as parameter:

  def render(self, name, value, attrs=None, renderer=None):
        """Render the widget as an HTML string."""
        context = self.get_context(name, value, attrs)
        return self._render(self.template_name, context, renderer)

Can anyone help me with this?

@KMaina-N
Copy link

KMaina-N commented Mar 5, 2024

I am experiencing the same issue. Does anyone have solution?

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

2 participants