Exemple #1
0
def quote_list(request, template_name="quotes/quote_list.html", **kwargs):
    """
    A basic cxample of overriding a reusable apps view to customize.

    Displays quote list view. No paging added, but can be on your own.
    """

    from quoteme.views import quote_list

    favorite_jazz_album = getattr(settings, "FAVORITE_JAZZ_ALBUM", "Money Jungle")
    extra = {"favorite_jazz_album": favorite_jazz_album}

    return quote_list(request, template_name=template_name, extra_context=extra, **kwargs)
Exemple #2
0
Fichier : views.py Projet : 9gix/me
def quote_list(request, template_name='quotes/quote_list.html', **kwargs):
    '''
    A basic cxample of overriding a reusable apps view to customize.

    Displays quote list view. No paging added, but can be on your own.
    '''

    from quoteme.views import quote_list
    favorite_jazz_album = getattr(settings, 'FAVORITE_JAZZ_ALBUM', 'Money Jungle')
    extra = {
        'favorite_jazz_album': favorite_jazz_album,
    }

    return quote_list(request, template_name=template_name, extra_context=extra, **kwargs)
Exemple #3
0
def custom_quote_list(request):
    """Example view for overriding the existing quote_list view."""

    page_size = getattr(settings, "QUOTE_PAGE_SIZE", 0)
    extra = {}

    try:
        # we're going to add custom company address to the view for the example
        address = FlatBlock.objects.get(slug="company_address")
        extra = {"company_address": address}
    except FlatBlock.DoesNotExist:
        # not the end of the world if we don't have an address
        pass

    # wrapper around the quote_list
    return quote_list(request, paginate_by=page_size, extra_context=extra, template_name="quoteme/example_list.html")
Exemple #4
0
def quote_list(request, template_name='quotes/quote_list.html', **kwargs):
    '''
    A basic cxample of overriding a reusable apps view to customize.

    Displays quote list view. No paging added, but can be on your own.
    '''

    from quoteme.views import quote_list
    favorite_jazz_album = getattr(settings, 'FAVORITE_JAZZ_ALBUM',
                                  'Money Jungle')
    extra = {
        'favorite_jazz_album': favorite_jazz_album,
    }

    return quote_list(request,
                      template_name=template_name,
                      extra_context=extra,
                      **kwargs)
Exemple #5
0
def custom_quote_list(request):
    """Example view for overriding the existing quote_list view."""

    page_size = getattr(settings,'QUOTE_PAGE_SIZE', 0)
    extra = {}

    try:
        #we're going to add custom company address to the view for the example
        address = FlatBlock.objects.get(slug='company_address')
        extra = {
            'company_address': address,
        }
    except FlatBlock.DoesNotExist:
        #not the end of the world if we don't have an address
        pass

    #wrapper around the quote_list
    return quote_list(request, paginate_by=page_size, extra_context=extra,
                    template_name="quoteme/example_list.html")