Django 1.8.x Documentationattrs) if value: value = force_text(self._format_value(value)) final_attrs = {'href': mark_safe(smart_urlquote(value))} html = format_html( '{} {}
', _('Currently:') the following exception: NameError: global name 'smart_urlquote' is not defined We forgot to add the import for that method. Go ahead and add the smart_urlquote import at the end of line 13 of django/ py so it looks as follows: from django.utils.html import escape, format_html, format_html_join, smart_urlquote Re-run the tests and everything should pass. If it doesn’t, make sure you correctly modified
{} {}0 码力 | 1685 页 | 6.01 MB | 1 年前3
Django 1.8.x Documentationvalue: value = force_text(self._format_value(value)) final_attrs = {'href': mark_safe(smart_urlquote(value))} html = format_html( '{} {}
{} the following exception: NameError: global name 'smart_urlquote' is not defined We forgot to add the import for that method. Go ahead and add the smart_urlquote import at the end of line 13 of django/ py so it looks as follows: from django.utils.html import escape, format_html, format_html_join, smart_urlquote Re-run the tests and everything should pass. If it doesn’t, make sure you correctly modified0 码力 | 2454 页 | 2.85 MB | 1 年前3
Django 3.0.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = contains a few functions that are handy for converting back and forth between strings and bytestrings. smart_str(s, encoding='utf-8', strings_only=False, errors='strict') converts its input to a string. The strings_only=False, errors='strict') is identical to smart_str() in almost all cases. The difference is when the first argument is a lazy translation instance. While smart_str() preserves lazy translations, force_str()0 码力 | 3085 页 | 2.95 MB | 1 年前3
Django 1.10.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = text. Here are the name changes in django.utils.encoding: Old name New name smart_str smart_bytes smart_unicode smart_text force_unicode force_text 500 Chapter 3. Using Django Django Documentation For backwards compatibility, the old names still work on Python 2. Under Python 3, smart_str is an alias for smart_text. For forwards compatibility, the new names work as of Django 1.4.2. Note: django0 码力 | 1817 页 | 6.19 MB | 1 年前3
Django 1.10.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = name smart_str smart_bytes smart_unicode smart_text force_unicode force_text For backwards compatibility, the old names still work on Python 2. Under Python 3, smart_str is an alias for smart_text. admin LogEntry tables described below), but your code must be prepared to call django.utils.encoding.smart_text() at times if it really wants to work with consistent data – Django will not do this for you0 码力 | 2538 页 | 2.59 MB | 1 年前3
Django 1.11.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = name smart_str smart_bytes smart_unicode smart_text force_unicode force_text For backwards compatibility, the old names still work on Python 2. Under Python 3, smart_str is an alias for smart_text. a few functions that are handy for converting back and forth between Unicode and bytestrings. • smart_text(s, encoding='utf-8', strings_only=False, errors='strict') converts its input to a Unicode string0 码力 | 1878 页 | 6.40 MB | 1 年前3
Django 1.11.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = New name smart_str smart_bytes Old name New name smart_unicode smart_text force_unicode force_text For backwards compatibility, the old names still work on Python 2. Under Python 3, smart_str is an an alias for smart_text. For forwards compatibility, the new names work as of Django 1.4.2. Note django.utils.encoding was deeply refactored in Django 1.5 to provide a more consistent API. Check its0 码力 | 2747 页 | 2.67 MB | 1 年前3
Django 3.2.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = a few functions that are handy for converting back and forth between strings and bytestrings. • smart_str(s, encoding='utf-8', strings_only=False, errors='strict') converts its input to a string. The strings_only=False, errors='strict') is identical to smart_str() in almost all cases. The difference is when the first argument is a lazy translation in- stance. While smart_str() preserves lazy translations, force_str()0 码力 | 2199 页 | 7.89 MB | 1 年前3
Django 3.0.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = a few functions that are handy for converting back and forth between strings and bytestrings. • smart_str(s, encoding='utf-8', strings_only=False, errors='strict') converts its input to a string. The strings_only=False, errors='strict') is identi- cal to smart_str() in almost all cases. The difference is when the first argument is a lazy translation instance. While smart_str() preserves lazy translations, force_str()0 码力 | 2002 页 | 6.73 MB | 1 年前3
Django 3.1.x Documentationis_valid() True We passed in no data to the formset which is resulting in a valid form. The formset is smart enough to ignore extra forms that were not changed. If we provide an invalid article: >>> data = a few functions that are handy for converting back and forth between strings and bytestrings. • smart_str(s, encoding='utf-8', strings_only=False, errors='strict') converts its input to a string. The strings_only=False, errors='strict') is identi- cal to smart_str() in almost all cases. The difference is when the first argument is a lazy translation instance. While smart_str() preserves lazy translations, force_str()0 码力 | 2053 页 | 6.92 MB | 1 年前3
共 30 条
- 1
- 2
- 3













