Mercurial > public > sg101
changeset 1039:bd59a599b9a3
Update dlwgetcat to use site scheme.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 31 Dec 2015 12:35:31 -0600 |
parents | 950dbf75634c |
children | 15f2585ae9a4 |
files | downloads/management/commands/dlwgetcat.py sg101/templates/downloads/commands/wget_cat.html |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/downloads/management/commands/dlwgetcat.py Thu Dec 31 12:28:30 2015 -0600 +++ b/downloads/management/commands/dlwgetcat.py Thu Dec 31 12:35:31 2015 -0600 @@ -42,10 +42,13 @@ ext = os.path.splitext(dl.file.name)[1] dl.dest_filename = slugify(dl.title) + ext + base_url = "{}://{}{}".format(settings.SITE_SCHEME, + Site.objects.get_current().domain, + settings.MEDIA_URL) + output = render_to_string('downloads/commands/wget_cat.html', { 'downloads': downloads, - 'domain': Site.objects.get_current().domain, - 'MEDIA_URL': settings.MEDIA_URL, + 'base_url': base_url, }) self.stdout.write(output)
--- a/sg101/templates/downloads/commands/wget_cat.html Thu Dec 31 12:28:30 2015 -0600 +++ b/sg101/templates/downloads/commands/wget_cat.html Thu Dec 31 12:35:31 2015 -0600 @@ -1,5 +1,5 @@ #!/bin/bash {% for dl in downloads %} -wget -O {{ dl.dest_filename }} http://{{ domain }}{{ MEDIA_URL }}{{ dl.file.name|urlencode }} +wget -O {{ dl.dest_filename }} {{ base_url }}{{ dl.file.name|urlencode }} {% endfor %}