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

Commit

Permalink
Allow blank=True in BaseConfig (but not Templates)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Jan 26, 2016
1 parent 3e7369a commit e96e262
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions django_netjsonconfig/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ def get_config(self):
config preprocessing (skipped for templates):
* inserts hostname automatically if not defined
"""
config = self.config or {} # might be ``None`` in some corner cases
if self.__template__:
return self.config
c = deepcopy(self.config)
return config
c = deepcopy(config)
c.setdefault('general', {})
if 'hostname' not in c['general']:
c['general']['hostname'] = self.name
Expand Down Expand Up @@ -178,6 +179,8 @@ def clean(self):
class Meta:
abstract = True

BaseConfig._meta.get_field('config').blank = True


class TemplatesMixin(models.Model):
"""
Expand Down

0 comments on commit e96e262

Please sign in to comment.