allowed to change created date
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from wtforms import Form, StringField, TextAreaField, SelectField, RadioField
|
from wtforms import Form, StringField, TextAreaField, SelectField, DateTimeField
|
||||||
from wtforms import IntegerField, PasswordField
|
from wtforms import IntegerField, PasswordField
|
||||||
from wtforms.validators import InputRequired, Length, Email
|
from wtforms.validators import InputRequired, Length, Email
|
||||||
from wtforms.widgets import HiddenInput
|
from wtforms.widgets import HiddenInput
|
||||||
@@ -14,10 +14,12 @@ class BlogCreateForm(Form):
|
|||||||
author = StringField('Auteur', validators=[InputRequired(), Length(min=1, max=50)],
|
author = StringField('Auteur', validators=[InputRequired(), Length(min=1, max=50)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
status = SelectField('Statut', choices=[('brouillon','Brouillon'),('privé','Privé'),('publié','Publié')])
|
status = SelectField('Statut', choices=[('brouillon','Brouillon'),('privé','Privé'),('publié','Publié')])
|
||||||
|
created = DateTimeField('Créé le', validators=[InputRequired()])
|
||||||
|
|
||||||
|
|
||||||
class BlogUpdateForm(BlogCreateForm):
|
class BlogUpdateForm(BlogCreateForm):
|
||||||
id = IntegerField(widget=HiddenInput())
|
id = IntegerField(widget=HiddenInput())
|
||||||
|
created = DateTimeField('Créé le', validators=[InputRequired()])
|
||||||
|
|
||||||
class BlogSearchForm(Form):
|
class BlogSearchForm(Form):
|
||||||
criteria = StringField('Critère', validators=[InputRequired(), Length(min=3, max=45)],
|
criteria = StringField('Critère', validators=[InputRequired(), Length(min=3, max=45)],
|
||||||
|
|||||||
BIN
cao_sunyata/static/carousel/S16.jpg
Normal file
BIN
cao_sunyata/static/carousel/S16.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
@@ -35,12 +35,14 @@
|
|||||||
{{ form.status(class_='form-control') }}
|
{{ form.status(class_='form-control') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="required-field" for="created">{{ form.created.label }}</label>
|
||||||
|
{{ form.created(class_='form-control') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Topic : <strong>{{ entry.topic_id }}</strong><br>
|
Topic : <strong>{{ entry.topic_id }}</strong><br>
|
||||||
{% if blog_id != '0' %}
|
{% if blog_id != '0' %}
|
||||||
Créé le : <strong>{{ entry.created.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
|
||||||
<button class="btn btn-link" type="submit" name="form.update_created">[ Mettre à jour ]</button>
|
|
||||||
<br>
|
|
||||||
Modifié le : <strong>{{ entry.edited.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
Modifié le : <strong>{{ entry.edited.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ def blog_copy(request):
|
|||||||
dup_entry.tag = entry.tag
|
dup_entry.tag = entry.tag
|
||||||
dup_entry.author = entry.author
|
dup_entry.author = entry.author
|
||||||
dup_entry.status = 'brouillon'
|
dup_entry.status = 'brouillon'
|
||||||
|
dup_entry.created = datetime.datetime.now()
|
||||||
|
dup_entry.edited = datetime.datetime.now()
|
||||||
request.dbsession.add(dup_entry)
|
request.dbsession.add(dup_entry)
|
||||||
|
|
||||||
request.session.flash("La page a été duppliquée avec succès", 'success')
|
request.session.flash("La page a été duppliquée avec succès", 'success')
|
||||||
@@ -69,6 +71,7 @@ def blog_edit(request):
|
|||||||
# create a new post
|
# create a new post
|
||||||
entry = BlogRecord()
|
entry = BlogRecord()
|
||||||
entry.topic_id = topic
|
entry.topic_id = topic
|
||||||
|
entry.created = datetime.datetime.now()
|
||||||
form = BlogCreateForm(request.POST, entry)
|
form = BlogCreateForm(request.POST, entry)
|
||||||
form.tag.choices = [(row.tag, row.tag_name) for row in tags]
|
form.tag.choices = [(row.tag, row.tag_name) for row in tags]
|
||||||
page_title = 'Nouvelle page'
|
page_title = 'Nouvelle page'
|
||||||
@@ -103,12 +106,6 @@ def blog_edit(request):
|
|||||||
entry.editor = request.authenticated_userid
|
entry.editor = request.authenticated_userid
|
||||||
return HTTPFound(location=request.route_url('blog', id=entry.id, slug=entry.slug))
|
return HTTPFound(location=request.route_url('blog', id=entry.id, slug=entry.slug))
|
||||||
|
|
||||||
if 'form.update_created' in request.params and form.validate():
|
|
||||||
del form.id # SECURITY: prevent overwriting of primary key
|
|
||||||
form.populate_obj(entry)
|
|
||||||
entry.created = datetime.datetime.now()
|
|
||||||
return HTTPFound(location=request.route_url('blog', id=entry.id, slug=entry.slug))
|
|
||||||
|
|
||||||
if 'form.deleted' in request.params:
|
if 'form.deleted' in request.params:
|
||||||
BlogRecordService.delete(request, blog_id)
|
BlogRecordService.delete(request, blog_id)
|
||||||
request.session.flash("La page a été supprimée avec succès.", 'success')
|
request.session.flash("La page a été supprimée avec succès.", 'success')
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ def home(request):
|
|||||||
dir + '/S09.jpg',
|
dir + '/S09.jpg',
|
||||||
dir + '/S12.jpg',
|
dir + '/S12.jpg',
|
||||||
dir + '/S15.jpg',
|
dir + '/S15.jpg',
|
||||||
|
dir + '/S16.jpg',
|
||||||
dir + '/S18.jpg',
|
dir + '/S18.jpg',
|
||||||
dir + '/S21.jpg',
|
dir + '/S21.jpg',
|
||||||
dir + '/S25.jpg']
|
dir + '/S25.jpg']
|
||||||
|
|||||||
Reference in New Issue
Block a user