我正在尝试从github运行以下包 - https://github.com/rollstudio/django-admin2-sb
但我得到以下追溯
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/djadmin2/__init__.py", line 13, in <module>
from . import core
File "/usr/local/lib/python2.7/dist-packages/djadmin2/core.py", line 14, in <module>
from . import apiviews
File "/usr/local/lib/python2.7/dist-packages/djadmin2/apiviews.py", line 12, in <module>
from .viewmixins import Admin2Mixin
File "/usr/local/lib/python2.7/dist-packages/djadmin2/viewmixins.py", line 15, in <module>
from braces.views import AccessMixin
ImportError: cannot import name AccessMixin
安装了大括号我可以在以下位置看到它 -
/usr/local/lib/python2.7/dist-packages/braces/views
_access.py
包含课程class AccessMixin(object):
那为什么不进口呢?
答案 0 :(得分:1)
在 django-braces 1.3 中,视图已导出views._access
,但在 django-braces 1.4 中,这已移至Add(RangeCollection collection2)
for each int n in collection2.singles
if n >= infinite_range_start: next n
// there should only be one infinite range
for each range r in ranges // ranges should be a sorted list
if n = r.start - 1
r.start = n
next n
if n = r.end + 1
r.end = n
next n
if n < r.end: break
if n >= r.start and n <= range.end: next n
// at this point we know n is not within any ranges
singles.Add(n) // should be a set
CheckSinglesForRanges()
MergeOverlappingRanges()
CheckInfiniteRange()
CheckSinglesForRanges()
singleList = singles.ToOrderedList()
start = null
end = null
for each number n in singleList
if start = null
start = n
next n
if n = start + 1
end = n
next n
if start != null and end != null and end > start + 1
ranges.Add(new range(start, end))
start = null
end = null
if start != null and end != null and end > start + 1
ranges.Add(new range(start, end))
MergeOverLappingRanges()
// ranges should be a list of range objects ordered by range.start
prevR = null
for each range r in ranges
if prevR = null
prevR = r
next r
if prevR.end >= r.start
prevR.end = r.end
ranges.Remove(r)
next r
prevR = r
CheckInfiniteRange()
if singles.largest = inifinite_range_start - 1
inifinite_range_start--
CheckInfiniteRange()
if ranges.last.end >= inifinite_range_start - 1
inifinite_range_start = ranges.last.start
ranges.remove(ranges.last)
singles.RemoveAll(where n >= infinite_range_start)
CheckInfiniteRange()
Subtract(RangeCollection collection2)
for each number n in collection2.singles
if singles.Contains(n)
singles.remove(n)
next n
for each range r in ranges
if n = r.start
r.start++
next n
if n = r.end
r.end--
next n
if n > r.start and n < r.end:
if n = r.start + 1
singles.add(r.start)
ranges.add(new range(n + 1, r.end))
if n = r.end - 1
singles.add(r.end)
ranges.add(new range(n.start, n - 1))
else
ranges.add(new range(r.start, n - 1))
ranges.add(new range(n + 1, r.end))
ranges.Remove(r)
next n
if n = infinite_range_start
infinite_range_start++
next n
if n = infinite_range_start + 1
singles.add(infinite_range_start)
infinite_range_start = n + 1
next n
if n > infinite_range_start
ranges.add(new range(infinite_range_start, n - 1))
infinite_range_start = n + 1
next n
,未在视图中导出。
这应该在版本&gt; 1.4
此错误的另一种解决方法是将django-braces降级为版本1.3.1。
查看此github问题:https://github.com/pydanny/django-admin2/issues/396