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

Commit

Permalink
[admin] Include default_templates variable only in Config
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Mar 10, 2016
1 parent 0fcfd65 commit 0948999
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions django_netjsonconfig/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ def get_extra_context(self, pk=None):

def add_view(self, request, form_url='', extra_context={}):
extra_context.update(self.get_extra_context())
extra_context.update({
'default_templates': [str(t.id) for t in Template.objects.filter(default=True)]
})
if 'config' in self.model.__name__.lower():
extra_context.update({
'default_templates': [str(t.id) for t in Template.objects.filter(default=True)]
})
return super(BaseConfigAdmin, self).add_view(request, form_url, extra_context)

def change_view(self, request, pk, form_url='', extra_context={}):
Expand Down

0 comments on commit 0948999

Please sign in to comment.