mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-05-20 05:11:54 +00:00
Don't print to stdout in when creating default error templates, if verbosity = 0.
This commit is contained in:
parent
46d1f8b21b
commit
a0797ec6f9
1 changed files with 6 additions and 2 deletions
|
|
@ -37,6 +37,8 @@ class Command(NoArgsCommand):
|
|||
except Site.DoesNotExist:
|
||||
raise CommandError("Please make sure to have the sites contrib "
|
||||
"app installed and setup with a site object")
|
||||
|
||||
verbosity = int(options.get('verbosity', 1))
|
||||
for error_code in (404, 500):
|
||||
template, created = Template.objects.get_or_create(
|
||||
name="%s.html" % error_code)
|
||||
|
|
@ -44,6 +46,8 @@ class Command(NoArgsCommand):
|
|||
template.content = TEMPLATES.get(error_code, '')
|
||||
template.save()
|
||||
template.sites.add(site)
|
||||
print "Created database template for %s errors." % error_code
|
||||
if verbosity >= 1:
|
||||
self.stdout.write("Created database template for %s errors.\n" % error_code)
|
||||
else:
|
||||
print "A template for %s errors already exists." % error_code
|
||||
if verbosity >= 1:
|
||||
self.stderr.write("A template for %s errors already exists.\n" % error_code)
|
||||
|
|
|
|||
Loading…
Reference in a new issue