在Django,如何在他孩子的管理员变更列表页面上制作父对象的现场表演和可编辑?

时间:2016-04-07 02:04:57

标签: django django-models django-forms django-admin

我们说我们有两种模式:

List<object> endress = new List<object>();

        //filter all timestamps, getting only the date info
        var timeStamps = ds.AsEnumerable().Select(r=> ((DateTime)r["Timestamp"]).Date).Distinct();

        //for each id
        foreach (var timeStamp in timeStamps)
        {
            //find all the same timestamp (on the same day)
            var listSameTimestamp = ds.AsEnumerable().Where(r => ((DateTime)r["Timestamp"]).Date == timeStamp);

            var listIds = listSameTimestamp.Select(r => (int)r["curveID"]).Distinct();

            //ensure they all have the curveIDs you are looking for
            var haveThemAll = curveIds.Intersect(listIds).Count() == curveIds.Count();

            if (haveThemAll == false)
                continue;

            //find the lowest timestamp
            var rowFound = listSameTimestamp.OrderBy(r => (DateTime)r["Timestamp"]).FirstOrDefault();
            if (rowFound == null)
                continue;

            //create an anonymous object (coud not understand your needs)
            endress.Add(new
            {
                Timestamp = (DateTime)rowFound["Timestamp"],
                Spread = (double)rowFound["mid"] - 0.4 * (double)rowFound["mid"],
                Power = (double)rowFound["mid"]
            });                   
        }

如何在Book Model的更改列表页面上编写作者的first_name和last_name字段?

inline在这里没有帮助,因为我想在他孩子的管理员更改列表视图中编辑父对象的字段,而不是在Changeform视图中。

0 个答案:

没有答案