我有一个页面上有按钮的问题(django应用程序)。页面底部的按钮不起作用,顶部的所有按钮都工作正常。在底部只有保存按钮不起作用。 下面是我在模板中的代码。
以下是顶部:
上的按钮{% block top_menu %}
{% get_obj_perms user for current_calendar as "perm_list" %}
<form action="{% if post.pk %}{% url 'event_edit' post.pk %}{% else %}{% url 'event_create' %}{% endif %}" method="POST">
{% csrf_token %}
<fieldset {% if 'can_edit_posts' not in perm_list %}disabled="disabled"{% endif %}>
<input type="hidden" name="delete" value="" />
<ul class="btn-group">
<li><a href="{{ back_url|default:"/" }}"><span class="button"><i class="icon-left"></i>Back</span></a></li>
{% if 'can_edit_posts' in perm_list %}
<li><input class="button" id="save" type="submit" value="Save Changes" name="bottom_button"></li>
<li><a class="button" href="{{ back_url|default:"/" }}"><i class="icon-cancel-circled"></i>Discard Changes</a></li>
{% endif %}
{% if 'can_delete_posts' in perm_list and post.pk %}
<li><a class="button" href="{% url 'event_delete' post.pk %}"><i class="icon-trash"></i>Delete</a></li>
{% endif %}
</ul>
</fieldset>
</form>
{% endblock top_menu %}
以下是底部:
上的按钮{% block bottom_menu %}
{% get_obj_perms user for current_calendar as "perm_list" %}
<form action="{% if post.pk %}{% url 'event_edit' post.pk %}{% else %}{% url 'event_create' %}{% endif %}" method="POST">
{% csrf_token %}
<fieldset {% if 'can_edit_posts' not in perm_list %}disabled="disabled"{% endif %}>
<input type="hidden" name="delete" value="" />
<ul class="btn-group">
<li><a href="{{ back_url|default:"/" }}"><span class="button"><i class="icon-left"></i>Back</span></a></li>
{% if 'can_edit_posts' in perm_list %}
<li><input class="button" id="save" type="submit" value="Save Changes" name="bottom_button"></li>
<li><a class="button" href="{{ back_url|default:"/" }}"><i class="icon-cancel-circled"></i>Discard Changes</a></li>
{% endif %}
{% if 'can_delete_posts' in perm_list and post.pk %}
<li><a class="button" href="{% url 'event_delete' post.pk %}"><i class="icon-trash"></i>Delete</a></li>
{% endif %}
</ul>
</fieldset>
</form>
{% endblock bottom_menu %}
当我使用底部按钮时,我收到了django错误:
status
This field is required.
calendar
This field is required.
pub_date
This field is required.
任何帮助将不胜感激。谢谢!