Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Commit

Permalink
[admin] Moved submit_line.html to openwisp-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Jul 10, 2017
1 parent 3a8d452 commit 5945b70
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 27 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Add ``django_netjsonconfig``, ``django.contrib.admin``, ``sortedm2m`` and ``reve
INSTALLED_APPS = [
# other apps
'openwisp_utils.admin_theme',
'django_netjsonconfig',
# ensure the django admin comes after django-netjsonconfig
'django.contrib.admin',
Expand Down
15 changes: 12 additions & 3 deletions django_netjsonconfig/base/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,25 @@ class Media:

def get_extra_context(self, pk=None):
prefix = 'admin:{0}_{1}'.format(self.opts.app_label, self.model.__name__.lower())
text = _('Preview configuration')
ctx = {
'submit_line': 'admin/django_netjsonconfig/submit_line.html',
'preview_url': reverse('{0}_preview'.format(prefix))
'additional_buttons': [
{
'type': 'button',
'url': reverse('{0}_preview'.format(prefix)),
'class': 'previewlink',
'value': text,
'title': '{0} (ALT+P)'.format(text)
}
]
}
if pk:
ctx['download_url'] = reverse('{0}_download'.format(prefix), args=[pk])
return ctx

def add_view(self, request, form_url='', extra_context=None):
extra_context = self.get_extra_context()
extra_context = extra_context or {}
extra_context.update(self.get_extra_context())
instance = self.model()
if hasattr(instance, 'get_default_templates'):
templates = instance.get_default_templates()
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions django_netjsonconfig/templates/admin/submit_line.html

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ django-sortedm2m>=1.4.0,<1.5
django-reversion>=2.0.6,<2.1
django-x509>=0.2.0,<0.3.0
django-taggit>=0.22.1,<0.23.0
openwisp-utils<0.2
openwisp-utils>=0.1.2,<0.2
1 change: 1 addition & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'openwisp_utils.admin_theme',
'django_netjsonconfig',
'django.contrib.admin',
'sortedm2m',
Expand Down

0 comments on commit 5945b70

Please sign in to comment.