Giter VIP home page Giter VIP logo

django-nullablecharfield's People

Contributors

alepane21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

django-nullablecharfield's Issues

(Python 2.7, Django 1.9) Error: DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). You passed in <Address: [Bad Unicode data]> (<class 'ankets.models.Address'>)

Hello!
Thanks for you field :)
But I've got error when saving field with non-ascii value :

/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/forms/fields.py:142: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if value in self.empty_values and self.required:

/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/forms/fields.py:146: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if value in self.empty_values:

/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/db/models/base.py:1153: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if f.blank and raw_value in f.empty_values:

/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:546: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if value in self.empty_values:

/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/forms/fields.py:206: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  return initial_value != data_value

Internal Server Error: /admin/ankets/address/2/change/
Traceback (most recent call last):
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 541, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 244, in inner
    return view(request, *args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1438, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/utils/decorators.py", line 184, in inner
    return func(*args, **kwargs)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1385, in changeform_view
    self.log_change(request, new_object, change_message)
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 730, in log_change
    object_repr=force_text(object),
  File "/home/asdef/.virtualenvs/autotesting/local/lib/python2.7/site-packages/django/utils/encoding.py", line 88, in force_text
    raise DjangoUnicodeDecodeError(s, *e.args)
DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). You passed in <Address: [Bad Unicode data]> (<class 'ankets.models.Address'>)

My resolve: in file nullablecharfield/forms/fields.py
I chage line 19 from

        return smart_str(value)

to

        return value

South support

! South cannot introspect some fields; this is probably because they are custom
! fields. If they worked in 0.6 or below, this is because we have removed the
! models parser (it often broke things).
! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork

...I'll work on a PR for this.

release?

This looks useful! Would you be willing to upload a release to PyPI?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.