Giter VIP home page Giter VIP logo

Comments (3)

matijakolaric avatar matijakolaric commented on June 3, 2024

Its related to the fact that dates are not converted to datetime.date,
but remain unicode.

On 05.11.2014 16:33, Gordon Schultz wrote:

Hi,

when I'm using the date_hierarchy option to filter the change_list
admin page for a model, the db-backend raises a NotImplementedError.

Request Method: GET
Request URL: http://:/admin///
Django Version: 1.6
Exception Type: NotImplementedError
Exception Location:
//lib/python2.7/site-packages/django/db/backends/init.py in
datetime_extract_sql, line 755
Python Executable: /usr/bin/python
Python Version: 2.7.5

admin.py:
class MyModelAdmin(admin.ModelAdmin):
list_display = [ "", "", "date" ]
list_filter = [ "date" ]
date_hierarchy = "date"
ordering = [ "-date" ]

admin.site.register(MyModel, MyModelAdmin)

Environment:
Django==1.6
django-pyodbc==0.2.5
pyodbc==3.0.7

settings.py:
DATABASES = {
'default': {
'ENGINE': 'django_pyodbc',
'USER': '',
'PASSWORD': '',
'NAME': '',
'OPTIONS': {
'dsn': '',
'encoding': 'utf-8',
'autocommit': True,
}
}
}

When removing the line "date_hierarchy = "date"" everything works as
expected.


Reply to this email directly or view it on GitHub
#73.

from django-pyodbc.

GordonFreemem avatar GordonFreemem commented on June 3, 2024

So this feature is not usable with sqlserver?

from django-pyodbc.

matijakolaric avatar matijakolaric commented on June 3, 2024

No.
I have been going arounf the problem so far by using haks like:

    def extraInitForPeriod(*args, **kwargs):
        obj = kwargs.get('instance')
        if obj and obj.start_date:
            if isinstance(obj.start_date, basestring):
                obj.start_date = datetime.strptime(
                    obj.start_date, '%Y-%m-%d').date()

But for date_herarchy a proper fix would be needed.

from django-pyodbc.

Related Issues (20)

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.