-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Make copying context easier (for pasting into an editor or shell). #1840
Comments
This is a solid idea. I suspect we need to print the @stuaxo do you have the availability to create a PR? |
I can probably start with the !r bit, it's a small thing - useful. Do you have pointers in DDT codebase I can look at? |
This is the part of the code that renders that html: https://github.com/jazzband/django-debug-toolbar/blob/main/debug_toolbar/templates/debug_toolbar/panels/templates.html#L23 We'll want to add a button or something to it that allows copying the context here. Then hook into the click event handler in a template specific javascript file. You can see how history.js is defined and included, as well as how it handles button clicks: https://github.com/jazzband/django-debug-toolbar/blob/main/debug_toolbar/static/debug_toolbar/js/history.js Something that's not entirely clear is what exactly are you hoping to copy and paste? The examples in the original issue are valid python dictionaries. Another challenge is that some of the context values are not going to be python values (see assignments to |
Hello, I'm new to open source contributions and would love to start contributing to this project. I've noticed that this issue is already assigned to @elijah0kello, but if there are any other beginner-friendly tasks or issues available, I would appreciate the opportunity to help out. As a newbie, I'm eager to learn and contribute, so any guidance or work you could assign to me would be great. Thank you! |
Hi @lav6301, I think it's fair for you to pick this issue up. As for other introductory issues we should have a beginner friendly label on them. |
Hi @tim-schilling, Thank you for assigning the issue to me! I'll start working on it right away. If I have any questions while working on this issue, I'll reach out for clarification. Thanks again for the opportunity! |
A lot of the time I'm looking at the context of templates, the next step is top paste it into an editor for reasons[1] - especially including pasting into a python shell or notebook to explore.
At the moment it's inconvenient: You have to manually select the data - making it easy to select things that aren't the context data, and the data isn't exactly in a useable format ready to paste into a python list.
See this example - the first and second items are not comma separated and there is no start and end bracket.:
It would be nice to have a "Copy to clipboard" button, perhaps that floats in the top right of the context.
It would also be good if the text was in a format that was likely to work in a python shell, but maybe that is a slightly different issue (at the
[1] - scrolling up and down in the browser is less convenient with everything there, searching is more fiddly etc
The text was updated successfully, but these errors were encountered: