コード例 #1
0
ファイル: views.py プロジェクト: kevinbluett/jailbreak-2014
def login(request, template=None):
    '''User login page'''

    login_form = create_form(LoginForm, request, request)
    if request.method == 'POST':
        login_form.save()

        return HttpResponseRedirect(reverse('accounts:profile'))

    return render(request, template, {
            'login_form': login_form,
            'login_page': True
        })
コード例 #2
0
def home(request, template=None):
    '''Home page'''
    context = RequestContext(request)

    contact_form = create_form(ContactForm, request)
    if request.method == "POST":
    	if contact_form.is_valid():
    		contact_form.save()
    		return HttpResponseRedirect(reverse('home'))

    context['events'] = Event.objects.all().filter(date__gte=datetime.date.today()).order_by('date')[:4]
    context['services'] = Service.objects.all()
    context['contact_form'] = contact_form

    context['home_page'] = True
    return render_to_response(template, context_instance=context)