Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

not working with latest django 2.1.7 #77

Open
xiuliren opened this issue Feb 14, 2019 · 2 comments
Open

not working with latest django 2.1.7 #77

xiuliren opened this issue Feb 14, 2019 · 2 comments

Comments

@xiuliren
Copy link

this seems a bug from django though:

Traceback (most recent call last):
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
    autoreload.check_errors(django.setup)()
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/jingpeng/workspace/django-jquery-file-upload/fileupload/models.py", line 5, in <module>
    class Picture(models.Model):
  File "/home/jingpeng/workspace/django-jquery-file-upload/fileupload/models.py", line 18, in Picture
    @models.permalink
AttributeError: module 'django.db.models' has no attribute 'permalink'
@JavisPeng
Copy link

you need a django with vesion 2.0.2

@buraste
Copy link

buraste commented Oct 18, 2019

this seems a bug from django though:

Traceback (most recent call last):
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
    autoreload.check_errors(django.setup)()
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/jingpeng/workspace/django-jquery-file-upload/jwu/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/jingpeng/workspace/django-jquery-file-upload/fileupload/models.py", line 5, in <module>
    class Picture(models.Model):
  File "/home/jingpeng/workspace/django-jquery-file-upload/fileupload/models.py", line 18, in Picture
    @models.permalink
AttributeError: module 'django.db.models' has no attribute 'permalink'

If you use Django >= 2.0.0 you can't use @model.permalink. You should use like that:

    def get_absolute_url(self):
        return reverse('upload-new')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants