Django:我如何在django rest api类基本视图中保存外键对象

时间:2016-09-08 15:23:26

标签: python django django-rest-framework

我有两个模特

用户&位置

具有位置外键的用户。因此,在发布请求时,如何在序列化程序中保存位置对象。我正在使用classbase视图。

以下是我的代码

  @for $i from 1 through $total-columns {
    .large-#{$i} {
      width: 100% * ($i/$total-columns);
    }
  }

  @for $i from 1 through $total-columns {
    .medium-#{$i} {
      width: 100% * ($i/$total-columns);
    }
  }

  @for $i from 1 through $total-columns {
    .small-#{$i} {
      width: 100% * ($i/$total-columns);
    }
  }

1 个答案:

答案 0 :(得分:2)

使用此代码:

break