Thanks for your help.

This is my code :

def custom_proc(request):
    "A context processor that provides 'authForm'"

    return {
        'authForm' : authForm,
        'event': event
    }

def home(request, city):
    paginator = Paginator(Event.objects.all(), 5)
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1
    try:
        event = paginator.page(page)
    except (EmptyPage, InvalidPage):
        event = paginator.page(paginator.num_pages)

    return render_to_response('event/event_list.html', {
        'event': event},
        context_instance=RequestContext(request,
processors=[custom_proc]))

I need to call the event object with the city argument on all my
views. So the better way is to put in a context_processor, isn't it ?
So I changed my code like that.

def custom_proc(request, city):
    "A context processor that provides 'authForm', 'event'."
#Event
    paginator = Paginator(Event.objects.filter(city=city), 5)
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1
    try:
        event = paginator.page(page)
    except (EmptyPage, InvalidPage):
        event = paginator.page(paginator.num_pages)

    return {
        'authForm' : authForm,
        'event': event
    }

def home(request):

    return render_to_response('home.html', {
        'event': event},
        context_instance=RequestContext(request,
processors=[custom_proc]))

This hypothesis produced an argument error. So, if I can't call
another argument in a context_process, maybe I can call it in the home
view but where ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to