djangadminbootstrapped弄乱了DateField、TimeField和PointField

2024-09-27 22:32:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚刚添加了django管理引导到我的项目。几乎一切都很好。 实际上有两个小虫子我在想怎么解决。 第一个是关于DateField和TimeField:当我在django管理员引导下时,没有日期/时间选择器。当我检查源代码时,没有生成关于两个选择器的源代码。当我停用django admin bootstrapped时,缺少的是:

Next to the DateField :

<span class="datetimeshortcuts">&nbsp;
<a href="javascript:DateTimeShortcuts.handleCalendarQuickLink(0, 0);">Today</a>&nbsp;|&nbsp;
<a href="javascript:DateTimeShortcuts.openCalendar(0);"
    id="calendarlink0"><img src="/static/admin/img/icon_calendar.gif" alt="Calendar">
</a></span>

Next to the TimeField :

^{pr2}$

第二个是关于一个PointField(我正在使用postGis),没有django管理引导,我的字段很好,但是当它引导时,我在开放层.js公司名称:

OpenLayers.js:679 Uncaught TypeError: Cannot read property 'w' of null 

所以,有两个问题(使用django 1.8和django管理引导):

1- How to recover a date/time picker in the admin interface ? 2- How to recover my PointField map picker in the admin interface ?

谢谢大家。(github上的问题(1)相同:https://github.com/django-admin-bootstrapped/django-admin-bootstrapped/issues/168但只有外部工作区(我更喜欢nativ工作区))


编辑:从我的网站包:./django/contrib/gis/admin/选项.py 我直接换了电话开放层.js到OpenLayer.debug.js为您提供更多信息。在

In OpenLayer.debug.js line 40008 is the source of the error :

setMap: function(map) {        
    OpenLayers.Layer.prototype.setMap.apply(this, arguments);

    if (!this.renderer) {
        this.map.removeLayer(this);
    } else {
        this.renderer.map = this.map;

        var newSize = this.map.getSize();
40008-> newSize.w = newSize.w * this.ratio;
        newSize.h = newSize.h * this.ratio;
        this.renderer.setSize(newSize);
    }
},

在这里,整个JS追踪OpenLayer.debug.js+GeoDjango索引:

Uncaught TypeError:无法读取null==>;的属性“w”;OpenLayers.debug.js:40008在

newSize.w = newSize.w * this.ratio;

在OpenLayers.Layer.Vector.OpenLayers.Class.setMap==>;OpenLayers.debug.js:8349在

layer.setMap(this);

在OpenLayers.Map.OpenLayers.类添加层==>;(索引):614

geodjango_gps_point.map.addLayer(geodjango_gps_point.layers.vector);

全球定位系统_点初始化==>;(索引):677(匿名函数)

<script type="text/javascript">geodjango_gps_point.init();</script>

Tags: thetodjangodebuggtmapadminjs
1条回答
网友
1楼 · 发布于 2024-09-27 22:32:33

有两个问题被描述出来了,并且为易读性差感到遗憾。所以这里有一些答案:

1 - The DateField and Timefield seems to be issued and this will be fix :

Fix 168 (last update 3 days ago)

2 - My PointField show up correctly after adding this options to settings.py :

DAB_FIELD_RENDERER = 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer'

谢谢

相关问题 更多 >

    热门问题