Fix bug dans l'url
This commit is contained in:
parent
9700de054f
commit
b60950b12d
@ -99,9 +99,12 @@ class TagForm(ModelForm):
|
||||
class Meta:
|
||||
model = Tag
|
||||
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):
|
||||
required_css_class = 'required'
|
||||
|
@ -8,7 +8,7 @@
|
||||
<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
|
||||
{% 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 %}
|
||||
|
||||
|
@ -16,14 +16,24 @@ register = template.Library()
|
||||
|
||||
@register.filter
|
||||
def is_facebook_url(url):
|
||||
if url is None:
|
||||
return False
|
||||
obj = urlparse(url)
|
||||
return obj.hostname.endswith("facebook.com")
|
||||
if obj and obj.hostname:
|
||||
return obj.hostname.endswith("facebook.com")
|
||||
else:
|
||||
return url
|
||||
|
||||
@register.filter
|
||||
def hostname_or_socialmedia(url):
|
||||
return url
|
||||
if url is None:
|
||||
return None
|
||||
obj = urlparse(url)
|
||||
if obj is None:
|
||||
return url
|
||||
hostname = obj.hostname
|
||||
if hostname.endswith("facebook.com"):
|
||||
if hostname and hostname.endswith("facebook.com"):
|
||||
if "event" in url:
|
||||
return _("facebook event")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user