feat: added modal to save most used snippets and pre-fill the code editor
Issue
Closes: Allow users to save most used snippets
Changes
- Added a modal to save code snippets
- Added a dropdown to select saved snippets
- Double click any code snippet to save it to db
Screenshots
Please look on CI/CD actions, there is a error:
django.urls.exceptions.NoReverseMatch: Reverse for 'admin_shell_savedsnippet_add' not found. 'admin_shell_savedsnippet_add' is not a valid view function or pattern name.
Problem is related to this part of template:
{% url 'admin:admin_shell_savedsnippet_add' %}
Unfortunately it not working in Django <= 3.1
This is corrent for 4.2
{% url 'admin:admin_shell_savedsnippet_add' %}
This form is proper for older versions:
{% url 'admin:django_admin_shell_savedsnippet_add' %}
I suggest to calculate URL on view level, for example in method
def get_saved_snipets_admin_url(self):
if django.VERSION < (4, 0):
reutrn reverse('....)
else:
return reverse('....)
and pass url in context
To check compatible of your code, you can launch tox command locally to tests application code for all supported versions django and python