小编Dan*_*aja的帖子

如何制作一个自动增量整数字段Django

问题很简单,我正在订购购物车,我需要在订单生成时自动增加一个字段.但我不知道如何使整数字段自动递增: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)

python django django-models

39
推荐指数
5
解决办法
11万
查看次数

JSONException:值<!DOCTYPE类型java.lang无法转换为JSONObject

伙计们,你可以帮助我一点,我得到这个错误:

"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)

java android json

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

django ×1

django-models ×1

java ×1

json ×1

python ×1