matthiask / plata

Plata - the lean and mean Django-based Shop
https://plata-django-shop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
202 stars 63 forks source link

value too long with postgresql #44

Open nvbn opened 12 years ago

nvbn commented 12 years ago

When i try to create the order, i saw:

/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2012-11-23 02:53:29.456187) while time zone support is active.
  RuntimeWarning)

And that:

  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/plata/shop/forms.py", line 72, in save
    order.save()
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/plata/shop/models.py", line 172, in save
    super(Order, self).save(*args, **kwargs)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/base.py", line 551, in save_base
    result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/manager.py", line 203, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/query.py", line 1593, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 910, in execute_sql
    cursor.execute(sql, params)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
DatabaseError: value too long for type character varying(3)
matthiask commented 12 years ago

What is the value of your CURRENCIES setting? And which countries are available in your shop? The country field only allows 3 characters; I mostly use django-countries, which stores only the ISO code and not the full country name.

matthiask commented 12 years ago

Please reopen if you have further information about this problem. Thanks!

nvbn commented 12 years ago

CURRENCIES = ('RUS',) And it works with mysql and sqlite, but not with postgresql.

matthiask commented 12 years ago

This sounds like a discrepancy between byte and character counting. Which database encoding / charset are you using?

nvbn commented 12 years ago

Encoding is ru_RU.UTF-8