django 在css里面怎么接收陆游里的参数

陆游里传入一个参数id,现在我想在css文件里使用改变这个id元素的样式,怎么传入这个id

你的css 只能写在页面去实现 这个功能
方式一 :你在页面定义两个样式 然后 在对应的标签去判断 根据传入的id参数 进行 切换显示
关于在页面判断:

{% if somevar == "x" %}
  This appears if variable somevar equals the string "x"
{% endif %}



关于后台参数怎么传入前端 在你对应的方法中 使用 变量定义出来 这样就在页面能拿到你对应的值了

   context = {"result":result,"teacher_name":teacher_name}
        return render(request=request,template_name="teacher/teacher_add.html",context=context)

如果还不懂请参考: