不确定这里发生了什么。我在模板渲染过程中遇到错误。
这是html文件代码的片段:
{% load jsonify %}
{% for geofence in geofences.all %}
<tr>
<td>{{ geofence.geofence_name }}</td>
<td>{{ geofence.location }}</td>
<td>{{ geofence.addressLineOne }}</td>
<td>{{ geofence.radius }} meters</td>
<td><span id="confirm_delete_{{ geofence.gimbal_id }}" class="confirm_delete"><a class="close_x_red_small" href="#" onclick="CancelDelete(); return false;"></a><em></em><a class="delete_button" href="{% url 'geofence_manager_delete' geofence.gimbal_id %}">Delete</a><ol></ol></span><a class="trash_sm" title="Delete "{{ geofence.geofence_name }}" Geofence" onclick="ConfirmDelete('{{ geofence.gimbal_id }}', '{{ geofence.geofence_name|jsonify }}'); return false;" href="#"></a></td>
</tr>
{% empty %}
<tr>
<td colspan="7">You currently have no Geofences.</td>
/tr>
{% endfor %}
在追溯中,显示错误的部分是:{{ geofence.geofence_name|jsonify }}
我认为jsonify存在问题,但究竟是什么呢?之前没有发生任何错误。有人可以对此有所了解吗?如果需要,我可以提供信息。
修改
按要求提供的模型:
class Geofence(models.Model):
geofence_name = models.CharField(max_length=255)
addressLineOne = models.CharField(max_length=255)
radius = models.IntegerField(validators=[MaxValueValidator(3000),MinValueValidator(50)])
latitude = models.FloatField('latitude', blank=True, null=True)
longitude = models.FloatField('longitude', blank=True, null=True)
gimbal_id = models.CharField(max_length=255, blank=True, default=0)
location = models.ForeignKey(Location)
def __unicode__(self):
return u'%s' % self.geofence_name