You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This doesn't work for class following diff should be applied to fix it
diff --git a/django_unused/unused/find_views.py b/django_unused/unused/find_views.py
index 4b5a766..4761ea1 100644
--- a/django_unused/unused/find_views.py
+++ b/django_unused/unused/find_views.py
@@ -1,10 +1,7 @@
url_view_names = get_view_names(urlpatterns, non_matches)
return url_view_names
@@ -107,10 +104,23 @@ def get_view_names(url_list, non_matches, view_names=None):
view_names = []
for entry in url_list:
# If the entry is not a single pattern, recursively traverse the lists until we hit a single pattern.
+
if hasattr(entry.callback, '__name__'):
name = entry.callback.__name__
elif hasattr(entry.callback, '__class__'):
name = entry.callback.__class__.__name__
else:
raise ValueError("can't find the name of this view -> {}".format(entry.callback))
if hasattr(entry, 'url_patterns'):
get_view_names(entry.url_patterns, non_matches, view_names)
# If a single pattern is not one of the non-matches, add it to our list of view names.
elif entry.callback.__name__ not in non_matches:
view_names.append(entry.callback.__name__)
elif name not in non_matches:
view_names.append(name)
return view_names
The text was updated successfully, but these errors were encountered:
This doesn't work for class following diff should be applied to fix it
diff --git a/django_unused/unused/find_views.py b/django_unused/unused/find_views.py
index 4b5a766..4761ea1 100644
--- a/django_unused/unused/find_views.py
+++ b/django_unused/unused/find_views.py
@@ -1,10 +1,7 @@
url_view_names = get_view_names(urlpatterns, non_matches)
return url_view_names
@@ -107,10 +104,23 @@ def get_view_names(url_list, non_matches, view_names=None):
view_names = []
for entry in url_list:
# If the entry is not a single pattern, recursively traverse the lists until we hit a single pattern.
+
return view_names
The text was updated successfully, but these errors were encountered: