Re: Django-jython problem when rendering admin user detail template

Diego Muñoz <[email protected]>
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAKXeoq5PRCRzsFjzzEKCW+vAhtuQT-HbH9ykbY8wFT5qPdsqjA@mail.gmail.com>
I made this question in StackOverflow to get answers and comments:

http://stackoverflow.com/questions/33637913/django-unicode-issue-with-datetime-in-jython-with-sqlite-jdbc

It seems there is a bug when reading the info provided by the JDBC from
django. The format that django gets is not the correct, as you can see in
the screenshot I attached in the question.

2015-11-10 16:00 GMT-03:00 Diego Muñoz <[email protected]>:

> I'd like to add some extra information:
>
> I am using the sqlite-jdbc-3.8.11.2.jar file, and I tried to dump data
> from auth.User with "jython manage.py dumpdata auth.User --indent=4
> --traceback" and I got this error:
>
> [Traceback (most recent call last):
>   File "manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/management/__init__.py",
> line 354, in execute_from_command_line
>     utility.execute()
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/management/__init__.py",
> line 346, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/management/base.py", line
> 394, in run_from_argv
>     self.execute(*args, **cmd_options)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/management/base.py", line
> 445, in execute
>     output = self.handle(*args, **options)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/management/commands/dumpdata.py",
> line 159, in handle
>     serializers.serialize(format, get_objects(), indent=indent,
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/serializers/__init__.py",
> line 129, in serialize
>     s.serialize(queryset, **options)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/serializers/base.py",
> line 61, in serialize
>     self.handle_field(obj, field)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/core/serializers/python.py",
> line 55, in handle_field
>     self._current[field.name] = field.value_to_string(obj)
>   File
> "/home/dmunoz/jsnmp/Lib/site-packages/django/db/models/fields/__init__.py",
> line 1487, in value_to_string
>     return '' if val is None else val.isoformat()
> AttributeError: 'unicode' object has no attribute 'isoformat'
>
> 2015-11-10 12:34 GMT-03:00 Diego Muñoz <[email protected]>:
>
>> Hi everyone,
>>
>> I recently created a Django 1.8.6 project in Jython, and installed
>> django-jython 1.8.0b3. I am successfully using the SQLite JDBC and created
>> a database in which I created a super user with "jython manage.py
>> createsuperuser".
>>
>> In the localhost:8000/admin/ page I can successfully login and create
>> users, but when I try to edit details about a User, I get an error:
>> 'unicode' object has no attribute 'tzinfo'. If I change my settings.py file
>> with USE_TZ = False, I get another error: 'unicode' object has no attribute
>> 'date'.
>>
>> I would greatly appreciate any help. The exception I get for each case is:
>>
>> *1. 'unicode' object has no attribute 'tzinfo':*
>>
>> AttributeError at /admin/auth/user/1/
>>
>> 'unicode' object has no attribute 'tzinfo'
>>
>> Request Method: GET
>> Request URL: http://localhost:8000/admin/auth/user/1/
>> Django Version: 1.8.6
>> Exception Type: AttributeError
>> Exception Value:
>>
>> 'unicode' object has no attribute 'tzinfo'
>>
>> Exception Location:
>> /home/dmunoz/jsnmp/Lib/site-packages/django/utils/timezone.py in is_aware,
>> line 337
>> Python Executable: /home/dmunoz/jsnmp/bin/jython
>> Python Version: 2.7.0
>> Python Path:
>>
>> ['/home/dmunoz/snmp/webswitcher',
>>  '/home/dmunoz/jsnmp/Lib/site-packages/django_jython-1.8.0b3-py2.7.egg',
>>  '/home/dmunoz/jsnmp/Lib/site-packages',
>>  '/home/dmunoz/jsnmp/Lib',
>>  '/home/dmunoz/opt/jython2.7.0/Lib',
>>  '__classpath__',
>>  '__pyclasspath__/']
>>
>> Server time: Tue, 10 Nov 2015 12:31:09 -0300
>>
>> Error during template rendering
>>
>> In template
>> /home/dmunoz/jsnmp/Lib/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html,
>> error at line 19
>>
>> *2. 'unicode' object has no attribute 'date':*
>>
>> AttributeError at /admin/auth/user/1/
>>
>> 'unicode' object has no attribute 'date'
>>
>> Request Method: GET
>> Request URL: http://localhost:8000/admin/auth/user/1/
>> Django Version: 1.8.6
>> Exception Type: AttributeError
>> Exception Value:
>>
>> 'unicode' object has no attribute 'date'
>>
>> Exception Location:
>> /home/dmunoz/jsnmp/Lib/site-packages/django/forms/widgets.py in decompress,
>> line 888
>> Python Executable: /home/dmunoz/jsnmp/bin/jython
>> Python Version: 2.7.0
>> Python Path:
>>
>> ['/home/dmunoz/snmp/webswitcher',
>>  '/home/dmunoz/jsnmp/Lib/site-packages/django_jython-1.8.0b3-py2.7.egg',
>>  '/home/dmunoz/jsnmp/Lib/site-packages',
>>  '/home/dmunoz/jsnmp/Lib',
>>  '/home/dmunoz/opt/jython2.7.0/Lib',
>>  '__classpath__',
>>  '__pyclasspath__/']
>>
>> Server time: Tue, 10 Nov 2015 12:28:18 -0300
>>
>> Error during template rendering
>>
>> In template
>> /home/dmunoz/jsnmp/Lib/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html,
>> error at line 19
>>
>> Regards,
>> Diego
>>
>>
>>
>

------------------------------------------------------------------------------

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.