Fix bug dans l'url
This commit is contained in:
parent
9700de054f
commit
b60950b12d
@ -99,9 +99,12 @@ class TagForm(ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Tag
|
model = Tag
|
||||||
fields = ["name", "description", "in_included_suggestions", "in_excluded_suggestions", "principal"]
|
fields = ["name", "description", "in_included_suggestions", "in_excluded_suggestions", "principal"]
|
||||||
widgets = {
|
|
||||||
"name": HiddenInput()
|
def __init__(self, *args, **kwargs):
|
||||||
}
|
super().__init__(*args, **kwargs)
|
||||||
|
if "name" in kwargs["initial"]:
|
||||||
|
self.fields["name"].widget = HiddenInput()
|
||||||
|
|
||||||
|
|
||||||
class TagRenameForm(Form):
|
class TagRenameForm(Form):
|
||||||
required_css_class = 'required'
|
required_css_class = 'required'
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
|
<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}{% block og_title %}Renseignement de l'étiquette {{ form.name.value }}{% endblock %}{% endblock %}
|
{% block title %}{% block og_title %}{% if form.name.value %}Renseignement de l'étiquette {{ form.name.value }}{% else %}Création d'une étiquette{% endif %}{% endblock %}{% endblock %}
|
||||||
|
|
||||||
{% block fluid %}{% endblock %}
|
{% block fluid %}{% endblock %}
|
||||||
|
|
||||||
|
@ -16,14 +16,24 @@ register = template.Library()
|
|||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def is_facebook_url(url):
|
def is_facebook_url(url):
|
||||||
|
if url is None:
|
||||||
|
return False
|
||||||
obj = urlparse(url)
|
obj = urlparse(url)
|
||||||
|
if obj and obj.hostname:
|
||||||
return obj.hostname.endswith("facebook.com")
|
return obj.hostname.endswith("facebook.com")
|
||||||
|
else:
|
||||||
|
return url
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def hostname_or_socialmedia(url):
|
def hostname_or_socialmedia(url):
|
||||||
|
return url
|
||||||
|
if url is None:
|
||||||
|
return None
|
||||||
obj = urlparse(url)
|
obj = urlparse(url)
|
||||||
|
if obj is None:
|
||||||
|
return url
|
||||||
hostname = obj.hostname
|
hostname = obj.hostname
|
||||||
if hostname.endswith("facebook.com"):
|
if hostname and hostname.endswith("facebook.com"):
|
||||||
if "event" in url:
|
if "event" in url:
|
||||||
return _("facebook event")
|
return _("facebook event")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user