Compare commits

...

2 Commits

Author SHA1 Message Date
root
e42e078dcc use markdown for schedule too 2018-06-10 13:44:16 +00:00
root
30d73ef969 fix anonymous contact submissions 2018-03-24 08:55:51 +00:00
4 changed files with 11 additions and 4 deletions

View File

@ -69,7 +69,7 @@ class Content(models.Model):
header = MarkdownxField(blank=True, null=True, default='')
body = MarkdownxField(blank=True, null=True, default='')
teaser = models.TextField(blank=True, null=True, validators=[MaxLengthValidator(200)])
schedule = models.TextField(blank=True, null=True)
schedule = MarkdownxField(blank=True, null=True, default='')
schedulebutton = models.CharField(db_column='scheduleButton', max_length=255, blank=True, null=True) # Field name made lowercase.
optbtn2 = models.CharField(db_column='optBtn2', max_length=127, blank=True, null=True) # Field name made lowercase.
opttext2 = models.TextField(db_column='optText2', blank=True, null=True) # Field name made lowercase.
@ -119,6 +119,10 @@ class Content(models.Model):
value = ''
return mark_safe(value)
@property
def formatted_schedule(self):
return mark_safe(markdownify(self.schedule))
@property
def typefilter(self):
return self.type

View File

@ -20,9 +20,11 @@
<script>
$('#captcha').on({
click: function() {
$('#csrf').val(getCookie('csrftoken'))
var token = $('input[name="csrfmiddlewaretoken"]')[1].value;
$('#csrf').val(token)
$('#contact').submit()
}
});
</script>
{% csrf_token %}
{% endblock %}

View File

@ -17,6 +17,6 @@
{% if content.schedule %}
<div class="schedule">
<h4>{{content.schedulebutton|default:"Schedule"}}</h4>
<p>{{ content.schedule|safe|linebreaks }}</p>
<p>{{ content.formatted_schedule }}</p>
</div>
{% endif %}

View File

@ -247,7 +247,8 @@ def redirect_event(request):
content = get_object_or_404(Content, shortname=shortname)
return redirect(content.get_absolute_url())
id = request.GET.get('id')
id = re.compile('\d+').findall(id)
if id:
id = re.compile('\d+').findall(id)
if id:
id = id[0]
content = get_object_or_404(Content, id=id)