Complete conversion of download views to CBV views using django-downloadview.
This also removes dependency on the filetransfers library.
This commit is contained in:
@@ -482,36 +482,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
''')
|
||||
|
||||
Package(label='django-filetransfers', license_text='''
|
||||
Copyright (c) Waldemar Kornewald, Thomas Wanschik, and all contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of All Buttons Pressed nor
|
||||
the names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''')
|
||||
|
||||
Package(label='django-pure-pagination', license_text='''
|
||||
Copyright (c) James Pacileo and contributors.
|
||||
All rights reserved.
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
import zipfile
|
||||
|
||||
try:
|
||||
import zlib
|
||||
import zlib # NOQA
|
||||
COMPRESSION = zipfile.ZIP_DEFLATED
|
||||
except:
|
||||
COMPRESSION = zipfile.ZIP_STORED
|
||||
|
||||
@@ -14,8 +14,7 @@ from django.views.generic.edit import (
|
||||
)
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
from django_downloadview import VirtualDownloadView
|
||||
from django_downloadview import VirtualFile
|
||||
from django_downloadview import VirtualDownloadView, VirtualFile
|
||||
from pure_pagination.mixins import PaginationMixin
|
||||
|
||||
from .forms import ChoiceForm
|
||||
|
||||
@@ -12,9 +12,16 @@ class Command(management.BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
management.call_command('createsettings', interactive=False)
|
||||
try:
|
||||
result = management.call_command('migrate', interactive=False)
|
||||
except OperationalError as exception:
|
||||
self.stderr.write(self.style.NOTICE('Unable to migrate the database. The initialsetup command is to be used only on new installations. To upgrade existing installations use the performupgrade command.'))
|
||||
management.call_command('migrate', interactive=False)
|
||||
except OperationalError:
|
||||
self.stderr.write(
|
||||
self.style.NOTICE(
|
||||
'Unable to migrate the database. The initialsetup '
|
||||
'command is to be used only on new installations. To '
|
||||
'upgrade existing installations use the performupgrade '
|
||||
'command.'
|
||||
)
|
||||
)
|
||||
raise
|
||||
management.call_command('createautoadmin', interactive=False)
|
||||
post_initial_setup.send(sender=self)
|
||||
|
||||
@@ -159,12 +159,6 @@ class RedirectionMixin(object):
|
||||
post_action_redirect = None
|
||||
action_cancel_redirect = None
|
||||
|
||||
def get_post_action_redirect(self):
|
||||
return self.post_action_redirect
|
||||
|
||||
def get_action_cancel_redirect(self):
|
||||
return self.action_cancel_redirect
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
post_action_redirect = self.get_post_action_redirect()
|
||||
action_cancel_redirect = self.get_action_cancel_redirect()
|
||||
@@ -188,6 +182,9 @@ class RedirectionMixin(object):
|
||||
RedirectionMixin, self
|
||||
).dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_action_cancel_redirect(self):
|
||||
return self.action_cancel_redirect
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(RedirectionMixin, self).get_context_data(**kwargs)
|
||||
context.update(
|
||||
@@ -199,6 +196,9 @@ class RedirectionMixin(object):
|
||||
|
||||
return context
|
||||
|
||||
def get_post_action_redirect(self):
|
||||
return self.post_action_redirect
|
||||
|
||||
def get_success_url(self):
|
||||
return self.next_url or self.previous_url
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
def skip_file_descriptor_check(func):
|
||||
def func_wrapper(item):
|
||||
item._skip_file_descriptor_test = True
|
||||
return func(item)
|
||||
return func_wrapper
|
||||
def func_wrapper(item):
|
||||
item._skip_file_descriptor_test = True
|
||||
return func(item)
|
||||
return func_wrapper
|
||||
|
||||
@@ -66,7 +66,7 @@ class TempfileCheckMixin(object):
|
||||
msg='Orphan temporary file. The number of temporary files and/or '
|
||||
'directories at the start and at the end of the test are not the '
|
||||
'same. Orphan entries: {}'.format(
|
||||
','.join(final_temporary_items-self._temporary_items)
|
||||
','.join(final_temporary_items - self._temporary_items)
|
||||
)
|
||||
)
|
||||
super(TempfileCheckMixin, self).tearDown()
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.contrib.auth.models import Group
|
||||
from django.core.urlresolvers import clear_url_caches, reverse
|
||||
from django.http import HttpResponse
|
||||
from django.template import Context, Template
|
||||
from django.test import TestCase
|
||||
|
||||
from permissions import Permission
|
||||
from permissions.models import Role
|
||||
|
||||
Reference in New Issue
Block a user