Employed a regular expression pattern in the PeriodConverter to check the period format first.
This commit is contained in:
@ -38,7 +38,9 @@ class TransactionTypeConverter:
|
||||
|
||||
class PeriodConverter:
|
||||
"""The path converter for the period."""
|
||||
regex = ".+"
|
||||
regex = ("([0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?)|"
|
||||
"([0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?)?-"
|
||||
"([0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?)?")
|
||||
|
||||
def to_python(self, value):
|
||||
"""Returns the period by the period specification.
|
||||
|
Reference in New Issue
Block a user