Python google.appengine.ext.db.DateTimeProperty() Examples
The following are 5
code examples of google.appengine.ext.db.DateTimeProperty().
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
google.appengine.ext.db
, or try the search function
.
Example #1
Source File: pager.py From browserscope with Apache License 2.0 | 5 votes |
def _decode_bookmark(self, bookmark): """Decodes a bookmark and prepares the values to be used on queries. Currently supported properties are DateTimeProperty, FloatProperty, IntegerProperty, StringProperty and ReferenceProperty. Returns: A dictionary of property names/values to be used in queries. """ required = list(self._bookmark_properties) required.append('_') try: bookmark = decode_bookmark(bookmark) # Ensure that all required values are available. for key in required: if key not in bookmark: return None except: return None for key in required: value = bookmark[key] if key == '_': self._first_result = bookmark[key] elif key == '__key__': bookmark[key] = db.Key(value) else: prop = getattr(self._model_class, key) if isinstance(prop, db.ReferenceProperty): bookmark[key] = db.Key(value) elif isinstance(prop, db.DateTimeProperty): bookmark[key] = parseDateTime(value) else: bookmark[key] = prop.data_type(value) return bookmark # from http://kbyanc.blogspot.com/2007/09/python-reconstructing-datetimes-from.html
Example #2
Source File: db.py From jbox with MIT License | 5 votes |
def convert_DateTimeProperty(model, prop, kwargs): """Returns a form field for a ``db.DateTimeProperty``.""" if prop.auto_now or prop.auto_now_add: return None kwargs.setdefault('format', '%Y-%m-%d %H:%M:%S') return f.DateTimeField(**kwargs)
Example #3
Source File: db.py From RSSNewsGAE with Apache License 2.0 | 5 votes |
def convert_DateTimeProperty(model, prop, kwargs): """Returns a form field for a ``db.DateTimeProperty``.""" if prop.auto_now or prop.auto_now_add: return None kwargs.setdefault('format', '%Y-%m-%d %H:%M:%S') return f.DateTimeField(**kwargs)
Example #4
Source File: db.py From googleapps-message-recall with Apache License 2.0 | 5 votes |
def convert_DateTimeProperty(model, prop, kwargs): """Returns a form field for a ``db.DateTimeProperty``.""" if prop.auto_now or prop.auto_now_add: return None kwargs.setdefault('format', '%Y-%m-%d %H:%M:%S') return f.DateTimeField(**kwargs)
Example #5
Source File: djangoforms.py From python-compat-runtime with Apache License 2.0 | 5 votes |
def get_form_field(self, **kwargs): """Return a Django form field appropriate for a date-time property. This defaults to a DateTimeField instance, except if auto_now or auto_now_add is set, in which case None is returned, as such 'auto' fields should not be rendered as part of the form. """ if self.auto_now or self.auto_now_add: return None defaults = {'form_class': forms.DateTimeField} defaults.update(kwargs) return super(DateTimeProperty, self).get_form_field(**defaults)