Exemple #1
0
def followed_user_pins(request):
    pins = Pin.objects.latest_pins_for_user(request.user)
    if pins.count() == 0:
        pins = Pin.objects.latest_pins()

    extra = {'showing_following_pins': True}

    return process_pin_list_request(request, pins, 'pins/index.html', extra)
def single_board(request, board_pk, slug):
	"""Shows all pins for certain board"""
	board = get_object_or_404(Board.objects.all().select_related('category'), is_active=True, pk=board_pk,
	category__is_active=True)
	pins = board.pin_set.filter(is_active=True).select_related('source_pin', 'domain','repinned_pin')

	extra = {'board': board}
	return process_pin_list_request(request, pins, "pins/rooms/single_board.html", extra)
def followed_user_pins(request):
	pins = Pin.objects.latest_pins_for_user(request.user)
	if pins.count() == 0:
		pins = Pin.objects.latest_pins()

	extra = {'showing_following_pins': True}

	return process_pin_list_request(request, pins, 'pins/index.html', extra)
def single_category(request, pk, slug):
	category = get_object_or_404(Category, pk=pk, is_active=True)
	
	if request.user.is_authenticated():
		pins = Pin.objects.latest_pins_for_user(request.user, category=pk)
		if pins.count() == 0:
			pins = Pin.objects.latest_pins(category=pk)
	else:
		pins = Pin.objects.latest_pins(category=pk)

	return process_pin_list_request(request, pins, 'pins/categories/single_category.html', {'category': category})
Exemple #5
0
def single_board(request, board_pk, slug):
    """Shows all pins for certain board"""
    board = get_object_or_404(Board.objects.all().select_related('category'),
                              is_active=True,
                              pk=board_pk,
                              category__is_active=True)
    pins = board.pin_set.filter(is_active=True).select_related(
        'source_pin', 'domain', 'repinned_pin')

    extra = {'board': board}
    return process_pin_list_request(request, pins,
                                    "pins/rooms/single_board.html", extra)
Exemple #6
0
def single_category(request, pk, slug):
    category = get_object_or_404(Category, pk=pk, is_active=True)

    if request.user.is_authenticated():
        pins = Pin.objects.latest_pins_for_user(request.user, category=pk)
        if pins.count() == 0:
            pins = Pin.objects.latest_pins(category=pk)
    else:
        pins = Pin.objects.latest_pins(category=pk)

    return process_pin_list_request(request, pins,
                                    'pins/categories/single_category.html',
                                    {'category': category})
Exemple #7
0
def all_pins(request):
    pins = Pin.objects.latest_pins()
    return process_pin_list_request(request, pins, 'pins/index.html')
def all_pins(request):
    pins = Pin.objects.latest_pins()
    return process_pin_list_request(request, pins, "pins/index.html")