Reordered the methods in TransactionFormView in the accounting application.
This commit is contained in:
parent
b8f852c5f2
commit
274d8dfeec
@ -809,11 +809,6 @@ class TransactionFormView(FormView):
|
||||
context["new_record_template"] = self._get_new_record_template_json()
|
||||
return context
|
||||
|
||||
def get_template_name(self) -> str:
|
||||
"""Returns the name of the template."""
|
||||
model_name = self.model.__name__.lower()
|
||||
return F"accounting/{model_name}_{self.txn_type}_form.html"
|
||||
|
||||
def _get_new_record_template_json(self) -> str:
|
||||
context = {"record_type": "TTT", "no": "NNN"}
|
||||
template_name = "accounting/include/record_form-transfer.html"\
|
||||
@ -821,6 +816,11 @@ class TransactionFormView(FormView):
|
||||
else "accounting/include/record_form-non-transfer.html"
|
||||
return json.dumps(render_to_string(template_name, context))
|
||||
|
||||
def get_template_name(self) -> str:
|
||||
"""Returns the name of the template."""
|
||||
model_name = self.model.__name__.lower()
|
||||
return F"accounting/{model_name}_{self.txn_type}_form.html"
|
||||
|
||||
def make_form_from_post(self, post: Dict[str, str]) -> TransactionForm:
|
||||
"""Creates and returns the form from the POST data."""
|
||||
return TransactionForm.from_post(post, self.txn_type, self.object)
|
||||
|
Loading…
Reference in New Issue
Block a user