created_dt is separate

This commit is contained in:
Daniel Tsvetkov 2020-08-11 13:17:53 +02:00
parent decef3f6a7
commit bb24a5172c
7 changed files with 60 additions and 4 deletions

1
sensitive_dev.py Normal file
View File

@ -0,0 +1 @@
ADMIN_PASSWORD = "password"

View File

@ -1,12 +1,14 @@
from oshipka.persistance import db, ModelController, index_service, LiberalBoolean, Ownable, Datable from oshipka.persistance import db, ModelController, index_service, LiberalBoolean, Ownable
class BlogPost(db.Model, ModelController, Ownable, Datable): class BlogPost(db.Model, ModelController, Ownable):
__searchable__ = ['body', ] __searchable__ = ['body', ]
filename = db.Column(db.UnicodeText,) filename = db.Column(db.UnicodeText,)
title = db.Column(db.UnicodeText,) title = db.Column(db.UnicodeText,)
body = db.Column(db.UnicodeText,) body = db.Column(db.UnicodeText,)
created_dt = db.Column(db.UnicodeText,)
updated_dt = db.Column(db.UnicodeText,)
index_service.searchables.append(BlogPost) index_service.searchables.append(BlogPost)

View File

@ -21,6 +21,20 @@
<textarea id="input-blog_post-body" <textarea id="input-blog_post-body"
name="body"></textarea> name="body"></textarea>
</td></tr> </td></tr>
<tr><td>
<label for="input-blog_post-created_dt">{{ _("created_dt") }}</label>:
</td><td>
<input id="input-blog_post-created_dt"
type="text" name="created_dt" autocomplete="off"
/>
</td></tr>
<tr><td>
<label for="input-blog_post-updated_dt">{{ _("updated_dt") }}</label>:
</td><td>
<input id="input-blog_post-updated_dt"
type="text" name="updated_dt" autocomplete="off"
/>
</td></tr>
</table> </table>
<input type="submit"> <input type="submit">
</form> </form>

View File

@ -7,4 +7,10 @@
{% endif %} {% endif %}
{% if "body" not in skip_list %} {% if "body" not in skip_list %}
<li id="display-blog_post-body"><strong>{{ _("body") }}</strong>: {{ instance.body }}</li> <li id="display-blog_post-body"><strong>{{ _("body") }}</strong>: {{ instance.body }}</li>
{% endif %}
{% if "created_dt" not in skip_list %}
<li id="display-blog_post-created_dt"><strong>{{ _("created_dt") }}</strong>: {{ instance.created_dt }}</li>
{% endif %}
{% if "updated_dt" not in skip_list %}
<li id="display-blog_post-updated_dt"><strong>{{ _("updated_dt") }}</strong>: {{ instance.updated_dt }}</li>
{% endif %} {% endif %}

View File

@ -10,6 +10,12 @@
{% if "body" not in skip_columns %} {% if "body" not in skip_columns %}
<th>{{ _("body") }}</th> <th>{{ _("body") }}</th>
{% endif %} {% endif %}
{% if "created_dt" not in skip_columns %}
<th>{{ _("created_dt") }}</th>
{% endif %}
{% if "updated_dt" not in skip_columns %}
<th>{{ _("updated_dt") }}</th>
{% endif %}
<th>{{ _("Actions") }}</th> <th>{{ _("Actions") }}</th>
</tr> </tr>
</thead> </thead>
@ -31,6 +37,16 @@
{{ instance.body }} {{ instance.body }}
</td> </td>
{% endif %} {% endif %}
{% if "created_dt" not in skip_columns %}
<td>
{{ instance.created_dt }}
</td>
{% endif %}
{% if "updated_dt" not in skip_columns %}
<td>
{{ instance.updated_dt }}
</td>
{% endif %}
<td> <td>
<a href="{{ url_for('update_blog_post', uuid=instance.id, _next=request.path) }}">e</a> | <a href="{{ url_for('update_blog_post', uuid=instance.id, _next=request.path) }}">e</a> |
<a href="{{ url_for('delete_blog_post', uuid=instance.id, _next=request.path) }}">x</a> <a href="{{ url_for('delete_blog_post', uuid=instance.id, _next=request.path) }}">x</a>

View File

@ -23,6 +23,22 @@
<textarea id="input-blog_post-body" <textarea id="input-blog_post-body"
name="body">{{ instance.body }}</textarea> name="body">{{ instance.body }}</textarea>
</td></tr> </td></tr>
<tr><td>
<label for="input-blog_post-created_dt">{{ _("created_dt") }}</label>:
</td><td>
<input id="input-blog_post-created_dt"
value="{{ instance.created_dt }}"
type="text" name="created_dt" autocomplete="off"
/>
</td></tr>
<tr><td>
<label for="input-blog_post-updated_dt">{{ _("updated_dt") }}</label>:
</td><td>
<input id="input-blog_post-updated_dt"
value="{{ instance.updated_dt }}"
type="text" name="updated_dt" autocomplete="off"
/>
</td></tr>
</table> </table>
<input type="submit"> <input type="submit">
</form> </form>

View File

@ -3,7 +3,6 @@ searchable:
- body - body
interits: interits:
- Ownable - Ownable
- Datable
access: access:
- verb: all - verb: all
login_required: true login_required: true
@ -21,4 +20,6 @@ columns:
- name: filename - name: filename
- name: title - name: title
- name: body - name: body
type: long_text type: long_text
- name: created_dt
- name: updated_dt