<commit_before>from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.views.generic import TemplateView
from corehq import AccountingInterface
from corehq.apps.accounting.forms import BillingAccountForm
from corehq.apps.accounting.models import BillingAccount
from corehq.apps.domain.decorators import require_superuser


@require_superuser
def view_billing_accounts(request):
    return render(request, "view_billing_accounts.html",
                  {'account_list': BillingAccount.objects.filter(),
                   })


@require_superuser
def accounting_default(request):
    return HttpResponseRedirect(AccountingInterface.get_url())


@require_superuser
def manage_billing_account(request, account_id):
    template = 'manage_account.html'
    account = BillingAccount.objects.get(id=account_id)
    parent_link = '<a href="%s">%s<a>' % (AccountingInterface.get_url(), AccountingInterface.name)
    return render(request,
                  template,
                  dict(account=account,
                       form=BillingAccountForm(account),
                       parent_link=parent_link))


# make sure to require superuser
class ManageBillingAccountView(TemplateView):
    template_name = 'manage_account.html'

    def get_context_data(self):
        account = BillingAccount.objects.get(id=self.args[0])
        return dict(account=account,
                    form=BillingAccountForm(account),
                    parent_link='<a href="%s">%s<a>' % (AccountingInterface.get_url(), AccountingInterface.name),
                    )

    def post(self, request, *args, **kwargs):
        pass<commit_msg>save data in Manage Billing Account<commit_after>from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.views.generic import TemplateView
from corehq import AccountingInterface
from corehq.apps.accounting.forms import BillingAccountForm
from corehq.apps.accounting.models import BillingAccount, Currency
from corehq.apps.domain.decorators import require_superuser


@require_superuser
def view_billing_accounts(request):
    return render(request, "view_billing_accounts.html",
                  {'account_list': BillingAccount.objects.filter(),
                   })


@require_superuser
def accounting_default(request):
    return HttpResponseRedirect(AccountingInterface.get_url())


@require_superuser
def manage_billing_account(request, account_id):
    template = 'manage_account.html'
    account = BillingAccount.objects.get(id=account_id)
    parent_link = '<a href="%s">%s<a>' % (AccountingInterface.get_url(), AccountingInterface.name)
    return render(request,
                  template,
                  dict(account=account,
                       form=BillingAccountForm(account),
                       parent_link=parent_link))


# make sure to require superuser
class ManageBillingAccountView(TemplateView):
    template_name = 'manage_account.html'

    def get_context_data(self):
        account = BillingAccount.objects.get(id=self.args[0])
        return dict(account=account,
                    form=BillingAccountForm(account),
                    parent_link='<a href="%s">%s<a>' % (AccountingInterface.get_url(), AccountingInterface.name),
                    )

    def post(self, request, *args, **kwargs):
        account = BillingAccount.objects.get(id=self.args[0])
        account.name = self.request.POST['client_name']
        account.salesforce_account_id = self.request.POST['salesforce_account_id']
        account.currency, _ = Currency.objects.get_or_create(code=self.request.POST['currency'])
        account.save()
        return self.get(request, *args, **kwargs)
{'fraction_non_alphanumeric': 0.09579060982191041, 'fraction_numerical': 0.0008094981111710739, 'mean_word_length': 3.4987864077669903, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7126176', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1003, 'n_words': 189}