Index: web/forms.py
===================================================================
--- web/forms.py
+++ web/forms.py
@@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django import forms
from django.utils.translation import ugettext_lazy as _
+from django.contrib.admin.widgets import AdminDateWidget
+
from parovoz.widgets import CharAndLinkWidget, DateCalField, DayPartField
class DivErrorList(forms.util.ErrorList):
"""
Класс для отображения ошибок в пользовательском вводе.
@@ -107,19 +109,10 @@
class Trip(forms.Form):
"""
Форма "Поездка"
"""
src_station = forms.CharField(
label=_(u'Departure station'),
max_length=128,
widget=CharAndLinkWidget(attrs={
'desc': _(u'searching'),
@@ -132,29 +125,10 @@
widget=CharAndLinkWidget(attrs={
'desc': _(u'searching'),
'url': "javascript:alert('arrival station list');"
})
)
- departure_date = DateCalField(
+ departure_date = forms.DateField(
label=_('Date of departure'),
input_formats=('%d.%m.%Y', '%d/%m/%Y', '%d-%m-%Y'),
- js="javascript:alert('show calendar');",
- desc=_(u'Click this button to show calendar.'),
- icon="http://www.blogger.com/img/b16-rounded.gif")
+ widget=AdminDateWidget)
Index: web/templates/base.html
===================================================================
--- web/templates/base.html
+++ web/templates/base.html
@@ -5,14 +5,27 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Language" content="ru"/>
<meta name="ROBOTS" content="ALL"/>
<meta name="generator" content="Django"/>
<title>{{ page_title }}</title>
+
<link rel="stylesheet" href="/css/style.css" type="text/css"/>
+ <link rel="stylesheet" type="text/css" href="/admin/media/css/base.css" />
+ <link rel="stylesheet" type="text/css" href="/admin/media/css/forms.css" />
+ <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/admin/media/css/ie.css" /><![endif]-->
+
<link rel="shortcut icon" href="/pics/favicon.png"/>
- <!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> -->
- <script type="text/javascript" src="/js/jquery.min.js"></script>
+
+ <script type="text/javascript">window.__admin_media_prefix__ = "/admin/media/";</script>
+
+ <script type="text/javascript" src="/admin/jsi18n/"></script>
+ <script type="text/javascript" src="/admin/media/js/core.js"></script>
+
+ <script type="text/javascript" src="/admin/media/js/admin/RelatedObjectLookups.js"></script>
+ <script type="text/javascript" src="/admin/media/js/jquery.min.js"></script>
+ <script type="text/javascript" src="/admin/media/js/jquery.init.js"></script>
+ <script type="text/javascript" src="/admin/media/js/actions.min.js"></script>
</head>
<body>
{% include "header.html" %}
{% block structure %}{% endblock %}
Index: web/urls.py
===================================================================
--- web/urls.py
+++ web/urls.py
@@ -17,10 +17,11 @@
# to INSTALLED_APPS to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
+ url(r'^admin/jsi18n', 'django.views.i18n.javascript_catalog', name='jsi18n'), # hack to use admin form widgets
# индексная страница
(r'^$', 'views.flatpage'),
(r'^register/$', 'views.register'),