Fixed the line length in the data models for PEP8.

This commit is contained in:
依瑪貓 2020-11-05 22:49:32 +08:00
parent a554974ea0
commit 21281da3ed

View File

@ -228,7 +228,8 @@ class Transaction(DirtyFieldsMixin, StampedModel, RandomPkModel):
for i in range(max_no[record_type]): for i in range(max_no[record_type]):
no = i + 1 no = i + 1
if F"{record_type}-{no}-id" in post: if F"{record_type}-{no}-id" in post:
record = Record.objects.get(pk=post[F"{record_type}-{no}-id"]) record = Record.objects.get(
pk=post[F"{record_type}-{no}-id"])
else: else:
record = Record( record = Record(
is_credit=(record_type == "credit"), is_credit=(record_type == "credit"),
@ -267,12 +268,11 @@ class Transaction(DirtyFieldsMixin, StampedModel, RandomPkModel):
"""Finds the max debit and record numbers from the POSTed form. """Finds the max debit and record numbers from the POSTed form.
Args: Args:
txn_type (str): The transaction type. txn_type: The transaction type.
post (dict[str,str]): The POSTed data. post: The POSTed data.
Returns: Returns:
dict[str,int]: The max debit and record numbers from the POSTed form. The max debit and record numbers from the POSTed form.
""" """
max_no = {} max_no = {}
if txn_type != "credit": if txn_type != "credit":
@ -281,7 +281,8 @@ class Transaction(DirtyFieldsMixin, StampedModel, RandomPkModel):
max_no["credit"] = 0 max_no["credit"] = 0
for key in post.keys(): for key in post.keys():
m = re.match( m = re.match(
"^(debit|credit)-([1-9][0-9]*)-(id|ord|account|summary|amount)$", ("^(debit|credit)-([1-9][0-9]*)-"
"(id|ord|account|summary|amount)$"),
key) key)
if m is None: if m is None:
continue continue