Python django.forms.utils.to_current_timezone() Examples

The following are 12 code examples of django.forms.utils.to_current_timezone(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.forms.utils , or try the search function .
Example #1
Source File: widgets.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def decompress(self, value):
        if value:
            value = to_current_timezone(value)
            return [value.date(), value.time().replace(microsecond=0)]
        return [None, None] 
Example #2
Source File: fields.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def prepare_value(self, value):
        if isinstance(value, datetime.datetime):
            value = to_current_timezone(value)
        return value 
Example #3
Source File: widgets.py    From bioforum with MIT License 5 votes vote down vote up
def decompress(self, value):
        if value:
            value = to_current_timezone(value)
            return [value.date(), value.time().replace(microsecond=0)]
        return [None, None] 
Example #4
Source File: fields.py    From bioforum with MIT License 5 votes vote down vote up
def prepare_value(self, value):
        if isinstance(value, datetime.datetime):
            value = to_current_timezone(value)
        return value 
Example #5
Source File: widgets.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def decompress(self, value):
        if value:
            value = to_current_timezone(value)
            return [value.date(), value.time()]
        return [None, None] 
Example #6
Source File: fields.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def prepare_value(self, value):
        if isinstance(value, datetime.datetime):
            value = to_current_timezone(value)
        return value 
Example #7
Source File: widgets.py    From python with Apache License 2.0 5 votes vote down vote up
def decompress(self, value):
        if value:
            value = to_current_timezone(value)
            return [value.date(), value.time().replace(microsecond=0)]
        return [None, None] 
Example #8
Source File: fields.py    From python with Apache License 2.0 5 votes vote down vote up
def prepare_value(self, value):
        if isinstance(value, datetime.datetime):
            value = to_current_timezone(value)
        return value 
Example #9
Source File: widgets.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def decompress(self, value):
        if value:
            value = to_current_timezone(value)
            return [value.date(), value.time().replace(microsecond=0)]
        return [None, None] 
Example #10
Source File: fields.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def prepare_value(self, value):
        if isinstance(value, datetime.datetime):
            value = to_current_timezone(value)
        return value 
Example #11
Source File: widgets.py    From python2017 with MIT License 5 votes vote down vote up
def decompress(self, value):
        if value:
            value = to_current_timezone(value)
            return [value.date(), value.time().replace(microsecond=0)]
        return [None, None] 
Example #12
Source File: fields.py    From python2017 with MIT License 5 votes vote down vote up
def prepare_value(self, value):
        if isinstance(value, datetime.datetime):
            value = to_current_timezone(value)
        return value