def get_form_success_data(self, form):
        """
        Allows customization of the JSON data returned when a valid form submission occurs.
        """
        data = {
            "html": render_to_string(
                "teams/_invite_form.html",
                {
                    "invite_form": self.get_unbound_form(),
                    "team": self.team
                },
                context_instance=RequestContext(self.request)
            )
        }

        membership = self.membership
        if membership is not None:
            if membership.state == Membership.STATE_APPLIED:
                fragment_class = ".applicants"
            elif membership.state == Membership.STATE_INVITED:
                fragment_class = ".invitees"
            elif membership.state in (Membership.STATE_AUTO_JOINED, Membership.STATE_ACCEPTED):
                fragment_class = {
                    Membership.ROLE_OWNER: ".owners",
                    Membership.ROLE_MANAGER: ".managers",
                    Membership.ROLE_MEMBER: ".members"
                }[membership.role]
            data.update({
                "append-fragments": {
                    fragment_class: render_to_string(
                        "teams/_membership.html",
                        {
                            "membership": membership,
                            "team": self.team
                        },
                        context_instance=RequestContext(self.request)
                    )
                }
            })
        return data
dataset/ETHPy150Open pinax/pinax-teams/pinax/teams/views.py/TeamInviteView.get_form_success_data/original