Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for missing URL names in Django 1.8-1.9. #90

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions silk/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,15 @@ def construct_request_model(self):
query_params = self.query_params()
path = self.request.path
resolved = resolve(path)
namespace = resolved.namespace
view_name = resolved.url_name
if namespace:
view_name = namespace + ':' + view_name
try:
# view_name is set in Django >= 1.8
view_name = resolved.view_name
except AttributeError:
# support for Django 1.6 and 1.7 in which no view_name is set
view_name = resolved.url_name
namespace = resolved.namespace
if namespace:
view_name = namespace + ':' + view_name
request_model = models.Request.objects.create(
path=path,
encoded_headers=self.encoded_headers(),
Expand Down