1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Move local_now() to utilities.datetime

This commit is contained in:
Jeremy Stretch
2024-03-21 15:59:51 -04:00
parent 6ac700e43f
commit 7b1a08a187
4 changed files with 15 additions and 11 deletions

View File

@ -3,7 +3,7 @@ from django.utils.translation import gettext_lazy as _
from extras.choices import DurationChoices
from utilities.forms.widgets import DateTimePicker, NumberWithOptions
from utilities.utils import local_now
from utilities.datetime import local_now
__all__ = (
'ReportForm',

View File

@ -3,7 +3,7 @@ from django.utils.translation import gettext_lazy as _
from extras.choices import DurationChoices
from utilities.forms.widgets import DateTimePicker, NumberWithOptions
from utilities.utils import local_now
from utilities.datetime import local_now
__all__ = (
'ScriptForm',

View File

@ -0,0 +1,13 @@
from django.utils import timezone
from django.utils.timezone import localtime
__all__ = (
'local_now',
)
def local_now():
"""
Return the current date & time in the system timezone.
"""
return localtime(timezone.now())

View File

@ -1,6 +1,4 @@
from django.db.models import ManyToOneRel
from django.utils import timezone
from django.utils.timezone import localtime
def dynamic_import(name):
@ -14,13 +12,6 @@ def dynamic_import(name):
return mod
def local_now():
"""
Return the current date & time in the system timezone.
"""
return localtime(timezone.now())
def get_related_models(model, ordered=True):
"""
Return a list of all models which have a ForeignKey to the given model and the name of the field. For example,