问题很简单,我正在订购购物车,我需要在订单生成时自动增加一个字段.但我不知道如何使整数字段自动递增:S任何帮助.
order.py
class Order(models.Model):
cart = models.ForeignKey(Cart)
add_date = models.DateTimeField(auto_now_add=True)
order_number = models.IntegerField()
enable = models.BooleanField(default=True)
Run Code Online (Sandbox Code Playgroud) 伙计们,你可以帮助我一点,我得到这个错误:
"JSONException: Value <!DOCTYPE of type java.lang cannot be converted to JSONObject"
Run Code Online (Sandbox Code Playgroud)
当我在解析数据时,这是我的代码:
public class JSONParser {
static InputStream is = null;
static JSONObject jObj = null;
static String json = "";
public JSONParser() {
}
public JSONObject getJSONFromUrl(String url) {
// Making HTTP request
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace(); …Run Code Online (Sandbox Code Playgroud)