mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
fix a number of A002 cases
This commit is contained in:
@ -181,7 +181,7 @@ def extract_named_group(name: str, value: str, fmt_string: str) -> str:
|
||||
def format_money(
|
||||
money: Money,
|
||||
decimal_places: Optional[int] = None,
|
||||
format: Optional[str] = None,
|
||||
fmt: Optional[str] = None,
|
||||
include_symbol: bool = True,
|
||||
) -> str:
|
||||
"""Format money object according to the currently set local.
|
||||
@ -189,7 +189,7 @@ def format_money(
|
||||
Args:
|
||||
money (Money): The money object to format
|
||||
decimal_places (int): Number of decimal places to use
|
||||
format (str): Format pattern according LDML / the babel format pattern syntax (https://babel.pocoo.org/en/latest/numbers.html)
|
||||
fmt (str): Format pattern according LDML / the babel format pattern syntax (https://babel.pocoo.org/en/latest/numbers.html)
|
||||
|
||||
Returns:
|
||||
str: The formatted string
|
||||
@ -199,8 +199,8 @@ def format_money(
|
||||
"""
|
||||
language = (None) or settings.LANGUAGE_CODE
|
||||
locale = Locale.parse(translation.to_locale(language))
|
||||
if format:
|
||||
pattern = parse_pattern(format)
|
||||
if fmt:
|
||||
pattern = parse_pattern(fmt)
|
||||
else:
|
||||
pattern = locale.currency_formats['standard']
|
||||
if decimal_places is not None:
|
||||
|
@ -328,11 +328,11 @@ class AjaxUpdateView(AjaxMixin, UpdateView):
|
||||
request, self.get_form(), context=self.get_context_data()
|
||||
)
|
||||
|
||||
def save(self, object, form, **kwargs):
|
||||
def save(self, obj, form, **kwargs):
|
||||
"""Method for updating the object in the database. Default implementation is very simple, but can be overridden if required.
|
||||
|
||||
Args:
|
||||
object: The current object, to be updated
|
||||
obj: The current object, to be updated
|
||||
form: The validated form
|
||||
|
||||
Returns:
|
||||
|
@ -136,7 +136,7 @@ class CurrencyExchangeView(APIView):
|
||||
serializer_class = None
|
||||
|
||||
@extend_schema(responses={200: common.serializers.CurrencyExchangeSerializer})
|
||||
def get(self, request, format=None):
|
||||
def get(self, request, fmt=None):
|
||||
"""Return information on available currency conversions."""
|
||||
# Extract a list of all available rates
|
||||
try:
|
||||
@ -563,7 +563,7 @@ class BackgroundTaskOverview(APIView):
|
||||
permission_classes = [permissions.IsAuthenticated, IsAdminUser]
|
||||
serializer_class = None
|
||||
|
||||
def get(self, request, format=None):
|
||||
def get(self, request, fmt=None):
|
||||
"""Return information about the current status of the background task queue."""
|
||||
import django_q.models as q_models
|
||||
|
||||
|
@ -444,35 +444,35 @@ def format_number(number, **kwargs):
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def format_datetime(datetime, timezone=None, format=None):
|
||||
def format_datetime(datetime, timezone=None, fmt=None):
|
||||
"""Format a datetime object for display.
|
||||
|
||||
Arguments:
|
||||
datetime: The datetime object to format
|
||||
timezone: The timezone to use for the date (defaults to the server timezone)
|
||||
format: The format string to use (defaults to ISO formatting)
|
||||
fmt: The format string to use (defaults to ISO formatting)
|
||||
"""
|
||||
datetime = InvenTree.helpers.to_local_time(datetime, timezone)
|
||||
|
||||
if format:
|
||||
return datetime.strftime(format)
|
||||
if fmt:
|
||||
return datetime.strftime(fmt)
|
||||
else:
|
||||
return datetime.isoformat()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def format_date(date, timezone=None, format=None):
|
||||
def format_date(date, timezone=None, fmt=None):
|
||||
"""Format a date object for display.
|
||||
|
||||
Arguments:
|
||||
date: The date to format
|
||||
timezone: The timezone to use for the date (defaults to the server timezone)
|
||||
format: The format string to use (defaults to ISO formatting)
|
||||
fmt: The format string to use (defaults to ISO formatting)
|
||||
"""
|
||||
date = InvenTree.helpers.to_local_time(date, timezone).date()
|
||||
|
||||
if format:
|
||||
return date.strftime(format)
|
||||
if fmt:
|
||||
return date.strftime(fmt)
|
||||
else:
|
||||
return date.isoformat()
|
||||
|
||||
|
Reference in New Issue
Block a user