Commits

psviderski committed f77870d

Preload PTIME widget with the current datetime.

Comments (0)

Files changed (2)

MoinMoin/forms.py

             dt = utctimestamp(dt)
         return dt
 
-DateTime = (DateTimeUNIX.with_properties(widget=WIDGET_DATETIME, placeholder=_("YYYY-MM-DD HH:MM:SS (example: 2999-12-31 23:59:59)"))
+DateTime = (DateTimeUNIX.with_properties(widget=WIDGET_DATETIME, placeholder=_("YYYY-MM-DD HH:MM:SS (example: 2013-12-31 23:59:59)"))
             .validated_by(Converted(incorrect=L_("Please use the following format: YYYY-MM-DD HH:MM:SS"))))
 
 File = FileStorage.with_properties(widget=WIDGET_FILE)

MoinMoin/items/__init__.py

         meta_form = BlogEntryMetaForm
         meta_template = 'modify_blog_entry_meta.html'
 
+    @classmethod
+    def from_item(cls, item):
+        form = super(BlogEntry._ModifyForm, cls).from_item(item)
+        # preload PTIME with the current datetime
+        if not form['meta_form']['ptime']:
+            form['meta_form']['ptime'].set(datetime.utcnow())
+        return form
+
     def do_show(self, revid):
         blog_item_name = self.name.rsplit('/', 1)[0]
         try: