mirror of
https://github.com/NaN-tic/trytond-galatea_blog-old.git
synced 2023-12-14 02:03:04 +01:00
Add post published date field
This commit is contained in:
parent
f40b58768f
commit
e80144b790
4 changed files with 24 additions and 5 deletions
7
blog.py
7
blog.py
|
@ -48,6 +48,7 @@ class Post(ModelSQL, ModelView):
|
|||
domain=[('active', '=', True)], required=True)
|
||||
post_create_date = fields.DateTime('Create Date', readonly=True)
|
||||
post_write_date = fields.DateTime('Write Date', readonly=True)
|
||||
post_published_date = fields.DateTime('Published Date', required=True)
|
||||
user = fields.Many2One('galatea.user', 'User', required=True)
|
||||
gallery = fields.Boolean('Gallery', help='Active gallery attachments.')
|
||||
comment = fields.Boolean('Comment', help='Active comments.')
|
||||
|
@ -104,10 +105,14 @@ class Post(ModelSQL, ModelView):
|
|||
def default_post_create_date():
|
||||
return datetime.now()
|
||||
|
||||
@staticmethod
|
||||
def default_post_published_date():
|
||||
return datetime.now()
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Post, cls).__setup__()
|
||||
cls._order.insert(0, ('post_create_date', 'DESC'))
|
||||
cls._order.insert(0, ('post_published_date', 'DESC'))
|
||||
cls._order.insert(1, ('name', 'ASC'))
|
||||
cls._error_messages.update({
|
||||
'delete_posts': ('You can not delete '
|
||||
|
|
|
@ -129,6 +129,14 @@ msgctxt "field:galatea.blog.post,post_create_date:"
|
|||
msgid "Create Date"
|
||||
msgstr "Fecha creación"
|
||||
|
||||
msgctxt "field:galatea.blog.post,post_published_date:"
|
||||
msgid "Published Date"
|
||||
msgstr "Data publicació"
|
||||
|
||||
msgctxt "field:galatea.blog.post,post_published_date:"
|
||||
msgid "Published Date"
|
||||
msgstr "Fecha publicación"
|
||||
|
||||
msgctxt "field:galatea.blog.post,post_write_date:"
|
||||
msgid "Write Date"
|
||||
msgstr "Fecha modificación"
|
||||
|
|
|
@ -26,9 +26,14 @@ this repository contains the full copyright notices and license terms. -->
|
|||
</page>
|
||||
<page string="Info" id="info">
|
||||
<label name="post_create_date"/>
|
||||
<field name="post_create_date"/>
|
||||
<field name="post_create_date" widget="date"/>
|
||||
<field name="post_create_date" widget="time"/>
|
||||
<label name="post_write_date"/>
|
||||
<field name="post_write_date"/>
|
||||
<field name="post_write_date" widget="date"/>
|
||||
<field name="post_write_date" widget="time"/>
|
||||
<label name="post_published_date"/>
|
||||
<field name="post_published_date" widget="date"/>
|
||||
<field name="post_published_date" widget="time"/>
|
||||
</page>
|
||||
<page string="Extra" id="extra">
|
||||
<label name="user"/>
|
||||
|
|
|
@ -4,6 +4,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<tree string="Posts">
|
||||
<field name="name"/>
|
||||
<field name="post_create_date" widget="date"/>
|
||||
<field name="post_published_date" widget="date"/>
|
||||
<field name="user"/>
|
||||
<field name="visibility"/>
|
||||
<field name="galatea_website"/>
|
||||
|
|
Loading…
Reference in a new issue