def get_context_data(self, **kwargs): kwargs = super().get_context_data(**kwargs) kwargs["can_pay"] = self.can_pay kwargs["backends"] = [x(self.object) for x in list_backends()] return kwargs
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["method"].choices = [(backend.name, backend.verbose) for backend in list_backends()]