In this link, http://plone.org/documentation/how-to/set-default-datetimefield-current-date-time it describes how to do this with new Schema attributes. I could update all umpteen content types in our system use this method, but I would prefer something a bit less work intensive, since if I have to change umpteen content types it will be all too easy to make a mistake.
A:
I could just make 'published' be the default work flow state. That should address the issue.
pydanny
2009-06-16 18:11:28
Unfortunately, this solution is not acceptable. My task is to make the default publication date on new content items to be the current date. Not create a work flow change.
pydanny
2009-06-16 18:15:37
+1
A:
maybe a js soln? have an onload event that looks for datetime widgets by id (or one of those common attributes) and then reset the time based on the browser time. You can filter new vs edit based on whether or not a non-prefilled required attribute has been filled yet (i.e. Title)
+1
A:
You could use archetypes.schemaextender to modify those types with an adapter:
in your configure.zcml
<adapter
factory=".adapters.DefaultDateModifier"
name="my-package-defaultdate"
/>
in the adapters.py
class DefaultDateModifier(object):
"""DefaultDateModifier adapter
"""
# XXX optionally adapt your content items iface here
adapts(ATCTMixin)
implements(ISchemaModifier)
def fiddle(self, schema):
# TODO switch out the default_method here...
pass
def __init__(self, context):
self.context = context
claytron
2009-06-16 18:48:56
How would that work against many (50+) Plone 2.5 content types running in Plone 3.x? Would I have to modify all of the many content types? Because that is what I would prefer not to do.
pydanny
2009-06-17 15:49:40
If all the types had a common interface or subclass (ATCTMixin for example) then you would just need to extend that once. Then all the types get the addition for free.You can also tag all those types with an interface via zcml if it came down to it. Then extend via that interface.
claytron
2009-06-17 23:23:43
This would be a great fix *but* we don't have a common interface or subclass.
pydanny
2009-06-27 06:50:47