Example #1
0
def select_issues_from_preselection(request, issues, cancel,
                                    post_process_selection=None,
                                    collection_list=None):
    if not issues.exists():
        raise ErrorWithMessage("No issues to select from.")
    data = {'issue': True,
            'allowed_selects': ['issue',],
            'return': add_selected_issues_to_collection,
            'cancel': cancel}
    if post_process_selection:
        data['post_process_selection'] = post_process_selection
    if collection_list:
        data['collection_list'] = collection_list
    select_key = store_select_data(request, None, data)
    context = {'select_key': select_key,
            'multiple_selects': True,
            'item_name': 'issue',
            'plural_suffix': 's',
            'no_bulk_edit': True,
            'all_pre_selected': True,
            'heading': 'Issues'
    }
    return paginate_response(request, issues,
                            'gcd/search/issue_list.html', context,
                            per_page=issues.count())
def select_issues_from_preselection(request,
                                    issues,
                                    cancel,
                                    post_process_selection=None,
                                    collection_list=None):
    if not issues.exists():
        raise ErrorWithMessage("No issues to select from.")
    data = {
        'issue': True,
        'allowed_selects': [
            'issue',
        ],
        'return': add_selected_issues_to_collection,
        'cancel': cancel
    }
    if post_process_selection:
        data['post_process_selection'] = post_process_selection
    if collection_list:
        data['collection_list'] = collection_list
    select_key = store_select_data(request, None, data)
    context = {
        'select_key': select_key,
        'multiple_selects': True,
        'item_name': 'issue',
        'plural_suffix': 's',
        'no_bulk_edit': True,
        'all_pre_selected': True,
        'heading': 'Issues'
    }
    return paginate_response(request,
                             issues,
                             'gcd/search/issue_list.html',
                             context,
                             per_page=issues.count())
Example #3
0
def mycomics_search(request):
    sqs = GcdSearchQuerySet().facet('facet_model_name')

    allowed_selects = ['issue', 'story']
    data = {'issue': True,
            'story': True,
            'allowed_selects': allowed_selects,
            'return': add_selected_issues_to_collection,
            'cancel': HttpResponseRedirect(urlresolvers\
                                           .reverse('collections_list'))}
    select_key = store_select_data(request, None, data)
    context = {'select_key': select_key,
               'multiple_selects': True,
               'allowed_selects': allowed_selects}
    return PaginatedFacetedSearchView(searchqueryset=sqs)(request,
                                                          context=context)
Example #4
0
def mycomics_search(request):
    sqs = GcdSearchQuerySet().facet('facet_model_name')

    allowed_selects = ['issue', 'story']
    data = {'issue': True,
            'story': True,
            'allowed_selects': allowed_selects,
            'return': add_selected_issues_to_collection,
            'cancel': HttpResponseRedirect(urlresolvers\
                                           .reverse('collections_list'))}
    select_key = store_select_data(request, None, data)
    context = {'select_key': select_key,
               'multiple_selects': True,
               'allowed_selects': allowed_selects}
    return PaginatedFacetedSearchView(searchqueryset=sqs)(request,
                                                          context=context)
Example #5
0
def select_issues_from_preselection(request, issues, cancel):
    data = {'issue': True,
            'allowed_selects': ['issue',],
            'return': add_selected_issues_to_collection,
            'cancel': cancel}
    select_key = store_select_data(request, None, data)
    context = {'select_key': select_key,
            'multiple_selects': True,
            'item_name': 'issue',
            'plural_suffix': 's',
            'no_bulk_edit': True,
            'all_pre_selected': True,
            'heading': 'Issues'
    }
    return paginate_response(request, issues,
                            'gcd/search/issue_list.html', context,
                            per_page=issues.count())
Example #6
0
def add_series_issues_to_collection(request, series_id):
    series = get_object_or_404(Series, id=series_id)
    issues = series.active_base_issues()
    if 'confirm_selection' in request.POST:
        # add all issues (without variants) to the selected collection
        collection_id = int(request.POST['collection_id'])
        collection = get_object_or_404(Collection, id=collection_id)
        item_before = collection.items.filter(issue__series__sort_name__lt=
                                              series.sort_name).reverse()

        if item_before:
            page = "?page=%d" % (item_before.count()/DEFAULT_PER_PAGE + 1)
        else:
            page = ""
        messages.success(request, u"All issues added to your "
                                   "<a href='%s%s'>%s</a> collection." % \
                                   (collection.get_absolute_url(), page,
                                    collection.name))
        return add_issues_to_collection(request, collection_id, issues,
          urlresolvers.reverse('show_series', kwargs={'series_id': series_id}))
    else:
        # allow user to choose which issues to add to the selected collection
        if request.GET['which_issues'] == 'all_issues':
            issues = series.active_issues()
        elif request.GET['which_issues'] == 'variant_issues':
            issues = series.active_issues().exclude(variant_of=None)
        data = {'issue': True,
                'allowed_selects': ['issue',],
                'return': add_selected_issues_to_collection,
                'cancel': HttpResponseRedirect(urlresolvers\
                            .reverse('show_series',
                                     kwargs={'series_id': series_id}))}
        select_key = store_select_data(request, None, data)
        context = {'select_key': select_key,
                'multiple_selects': True,
                'item_name': 'issue',
                'plural_suffix': 's',
                'no_bulk_edit': True,
                'all_pre_selected': True,
                'heading': 'Issues'
            }
        return paginate_response(request, issues,
                                 'gcd/search/issue_list.html', context,
                                 per_page=issues.count())
Example #7
0
def select_from_on_sale_weekly(request, year=None, week=None):
    issues_on_sale, context = do_on_sale_weekly(request, year, week)
    if context == None:
        return issues_on_sale
    data = {'issue': True,
            'allowed_selects': ['issue'],
            'return': add_selected_issues_to_collection}
    select_key = store_select_data(request, None, data)
    context.update({'select_key': select_key,
            'multiple_selects': True,
            'item_name': 'issue',
            'plural_suffix': 's',
            'no_bulk_edit': True,
            'all_pre_selected': True,
            'heading': 'Issues'
    })
    return paginate_response(request, issues_on_sale,
                             'gcd/status/issues_on_sale.html', context,
                             per_page=max(1,issues_on_sale.count()))
Example #8
0
def select_from_on_sale_weekly(request, year=None, week=None):
    issues_on_sale, context = do_on_sale_weekly(request, year, week)
    if context is None:
        return issues_on_sale
    data = {'issue': True,
            'allowed_selects': ['issue'],
            'return': add_selected_issues_to_collection}
    select_key = store_select_data(request, None, data)
    context.update({'select_key': select_key,
                    'multiple_selects': True,
                    'item_name': 'issue',
                    'plural_suffix': 's',
                    'no_bulk_edit': True,
                    'all_pre_selected': True,
                    'heading': 'Issues'
                    })
    return paginate_response(request, issues_on_sale,
                             'gcd/status/issues_on_sale.html', context,
                             per_page=max(1, issues_on_sale.count()))