jpwatts / django-positions

A Django field for custom model ordering.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django 2.0 "'PositionField' object has no attribute 'get_cache_name'"

jasonHav opened this issue · comments

Hi Guys,

I'm updating an (admittedly inherited) project to Django 2.0 and it uses your Django-positions library.

Since the upgrade, I'm getting the following error when rendering a PositionField:

'PositionField' object has no attribute 'get_cache_name'

I checked Django's side and it looks like that's no longer on IntegerFields (though I may be wrong). Any ideas or tips on where to go from where?

Was going to try out this module but hitting the same issue. Is there any fix for it?
Thanks.

@scanf I just switched over to the 'django2.0' branch and so far so good.

hey guys, sorry for the poor communication here- I've worked out most the issues with django 2.0 and now I'm spending a bit of time getting all the tests in working order. All of them are passing except for python3.6-django2.0-mysql and python2.6-django1.11-mysql, I should be able to fix those and cut a release on pypi tomorrow. If not, then definitely by mid next week.

What version of python are you guys running? Right now I only have python3.6 in the CI builds, but I suspect everything will work with 3.5 and 3.4. I'll add those to the build matrix upon request.

I saw the commit - definitely was not an easy switch :)
I'm on 3.6, and using Postgres (which explains why I've had no issues).

ok, I got everything working and cut a 0.6.0 release. definitely let me know if there are any problems.

I've got the same error with multi-table model inheritance, parent_link is set as described in the README.

error:

AttributeError at /admin/courses/imageslide/
'ImageSlide' object has no attribute 'position_cache'

models.py:

class Slide(models.Model):
    course = models.ForeignKey(Course, on_delete=models.CASCADE, related_name='slides')
    position = PositionField(collection='course', parent_link='slide_ptr_id')


class ImageSlide(Slide):
    image = models.ImageField(upload_to=upload_file_path, max_length=255)


class QuizSlide(Slide):
    question = models.CharField(max_length=255)

Has anyone tried django-positions with Django 2.0 and multi-table model inheritance yet?