Add event meta filter to organizer page

This commit is contained in:
Raphael Michel
2017-10-28 21:54:00 +02:00
parent 9767243a6d
commit 2bcb0b0ac1
6 changed files with 193 additions and 35 deletions

View File

@@ -667,7 +667,7 @@ class EventMetaProperty(LoggedModel):
name = models.CharField(
max_length=50, db_index=True,
help_text=_(
"Can not contain spaces or special characters execpt underscores"
"Can not contain spaces or special characters except underscores"
),
validators=[
RegexValidator(

View File

@@ -4,7 +4,17 @@ register = template.Library()
@register.simple_tag
def url_replace(request, field, value):
def url_replace(request, *pairs):
dict_ = request.GET.copy()
dict_[field] = value
return dict_.urlencode()
key = None
for p in pairs:
if key is None:
key = p
else:
if p == "":
if key in dict_:
del dict_[key]
else:
dict_[key] = p
key = None
return dict_.urlencode(safe='[]')