我可以在Django视图中破坏性地更改我的数据库吗?

我可以在Django视图中破坏性地更改我的数据库吗?,django,database,templates,view,Django,Database,Templates,View,因此,我正在加载查询集以发送到我的模板。其中一个对象是事件 现在,每个事件都有一系列属性,如“状态”和“员工”,所以在我的模板中,我只需 // incident.html // {% for incident in incidents %} <h1> {{ incident.employee }} - {{ incident.status }} </h1> {% endfor %} 然后在我的模板中,我可以访问event.mood以及event.status和ev

因此,我正在加载查询集以发送到我的模板。其中一个对象是事件

现在,每个事件都有一系列属性,如“状态”和“员工”,所以在我的模板中,我只需

// incident.html //

{% for incident in incidents %}
  <h1> {{ incident.employee }} - {{ incident.status }} </h1>
{% endfor %}
然后在我的模板中,我可以访问event.mood以及event.status和event.employee

// incident.html //

{% for incident in incidents %}
  <h1> {{ incident.employee }} - {{ incident.status }} </h1>
  <h3>  It was very {{ incident.mood }} </h3>
{% endfor %}
我是不是要毁掉我所有的数据,在我的每一次事故中都永久地把员工的名字命名为“唐老鸭”


提前感谢。

只要您不使用
.update()
进行更改或在进行更改后调用
.save()
,这些更改都不会在您的数据库中进行。否则,更改只存储在内存中,因此不是永久性的。

谢谢!我现在对即将到来的生产合并不再那么害怕了。
// incident.html //

{% for incident in incidents %}
  <h1> {{ incident.employee }} - {{ incident.status }} </h1>
  <h3>  It was very {{ incident.mood }} </h3>
{% endfor %}
// views.py //

def get_context_data(self, **kwargs):
  ...
  for incident in incidents:
    incident.employee = "Daffy Duck"