@login_required
def email(request, **kwargs):

    form_class = kwargs.pop("form_class", AddEmailForm)
    template_name = kwargs.pop("template_name", "account/email.html")

    group, bridge = group_and_bridge(kwargs)

    if request.method == "POST" and request.user.is_authenticated():
        if request.POST["action"] in "add":
            add_email_form = form_class(request.user, request.POST)
            if add_email_form.is_valid():
                add_email_form.save()
                messages.add_message(
                    request, messages.INFO,
                    ugettext(u"Confirmation email sent to %(email)s") % {
                        "email": add_email_form.cleaned_data["email"]
                    })
                add_email_form = form_class()  # @@@
        else:
            add_email_form = form_class()
            if request.POST["action"] == "send":
                email = request.POST["email"]
                try:
                    email_address = EmailAddress.objects.get(
                        user=request.user,
                        email=email,
                    )
                    messages.add_message(
                        request, messages.INFO,
                        ugettext("Confirmation email sent to %(email)s") % {
                            "email": email,
                        })
                    EmailConfirmation.objects.send_confirmation(email_address)
                except EmailAddress.DoesNotExist:
                    pass
            elif request.POST["action"] == "remove":
                email = request.POST["email"]
                try:
                    email_address = EmailAddress.objects.get(
                        user=request.user,
                        email=email
                    )
                    email_address.delete()
                    messages.add_message(
                        request, messages.SUCCESS,
                        ugettext("Removed email address %(email)s") % {
                            "email": email,
                        })
                except EmailAddress.DoesNotExist:
                    pass
            elif request.POST["action"] == "primary":
                email = request.POST["email"]
                email_address = EmailAddress.objects.get(
                    user=request.user,
                    email=email,
                )
                email_address.set_as_primary()
    else:
        add_email_form = form_class()

    ctx = group_context(group, bridge)
    ctx.update({
        "add_email_form": add_email_form,
    })

    return render_to_response(template_name, RequestContext(request, ctx))
dataset/ETHPy150Open amarandon/smeuhsocial/apps/account/views.py/email/operator `==` -> `in`