Exemplo n.º 1
0
def apps_subscription(request):
    form = SubscriptionForm(data=request.POST)
    if form.is_valid():
        responsys.subscribe('APP_DEV', form.cleaned_data['email'], format=form.cleaned_data['format'])
        messages.success(request, _('Thank you for subscribing to the Apps Developer newsletter.'))
        return HttpResponseRedirect(reverse('apps'))

    """Web landing page."""
    return common_landing(request, section=SECTION_APPS, extra={'form': form})
Exemplo n.º 2
0
def register(request):
    """Create a registration profile."""
    form = forms.RegisterForm(request.POST or None)
    if request.method == 'POST' and form.is_valid():
        # Create a registration profile, which also emails
        # activation details
        profile = RegisterProfile.objects.create_profile(
            form.cleaned_data['display_name'], form.cleaned_data['email'],
            form.cleaned_data['password'])

        # Sign the user up for mailing lists if they wanted
        if form.cleaned_data['email_subscribe']:
            try:
                subscribe(settings.RESPONSYS_CAMPAIGN,
                          form.cleaned_data['email'],
                          lang=get_language(),
                          source_url=request.build_absolute_uri())
            except Exception, err:
                log.warning(err)

        return jingo.render(request, 'users/register_done.html',
                            {'profile': profile})