mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 02:54:20 +00:00
Sanitize page name
This commit is contained in:
parent
4d6c4314e2
commit
d6b5db4a4b
@ -732,7 +732,15 @@ class Page(models.Model):
|
||||
Be careful with the _full_name attribute: this field may not be valid until you call save(). It's made for fast
|
||||
query, but don't rely on it when playing with a Page object, use get_full_name() instead!
|
||||
"""
|
||||
name = models.CharField(_('page name'), max_length=30, blank=False)
|
||||
name = models.CharField(_('page unix name'), max_length=30,
|
||||
validators=[
|
||||
validators.RegexValidator(
|
||||
r'^[\w.+-]+$',
|
||||
_('Enter a valid page name. This value may contain only '
|
||||
'letters, numbers ' 'and ./+/-/_ characters.')
|
||||
),
|
||||
],
|
||||
blank=False)
|
||||
parent = models.ForeignKey('self', related_name="children", verbose_name=_("parent"), null=True, blank=True, on_delete=models.SET_NULL)
|
||||
# Attention: this field may not be valid until you call save(). It's made for fast query, but don't rely on it when
|
||||
# playing with a Page object, use get_full_name() instead!
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h3>{% trans %}Page list{% endtrans %}</h3>
|
||||
<ul>
|
||||
{% for p in page_list %}
|
||||
<li><a href="{{ url('core:page', page_name=p.get_full_name()) }}">{{ p.get_display_name() }}</a></li>
|
||||
<li><a href="{{ p.get_absolute_url() }}">{{ p.get_display_name() }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
|
Loading…
Reference in New Issue
Block a user