From 0633572229672f6b7d36504143082ed6a99b5f10 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 22 Nov 2012 23:25:57 +0800 Subject: [PATCH] hack to reuse django admin widget for datetime field --- bbb_django/bbb/models.py | 3 ++- bbb_django/bbb/templates/base.html | 15 ++++++++++++--- bbb_django/bbb/templates/create.html | 9 +++++++++ bbb_django/bbb/urls.py | 5 +++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/bbb_django/bbb/models.py b/bbb_django/bbb/models.py index b365567..69e9305 100755 --- a/bbb_django/bbb/models.py +++ b/bbb_django/bbb/models.py @@ -3,6 +3,7 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ +from django.contrib.admin import widgets from urllib2 import urlopen from urllib import urlencode @@ -182,7 +183,7 @@ class CreateForm(forms.Form): welcome = forms.CharField(label=_('welcome message'), initial=_('Welcome!')) record = forms.BooleanField(label=_('record')) duration = forms.ChoiceField(label=_('duration'), choices=MEETING_DURATION) - start_time = forms.DateTimeField(label=_('start time'), initial=datetime.date.today()) + start_time = forms.DateTimeField(label=_('start time'), widget=widgets.AdminSplitDateTime()) def clean(self): data = self.cleaned_data diff --git a/bbb_django/bbb/templates/base.html b/bbb_django/bbb/templates/base.html index a9672fb..2b1f842 100644 --- a/bbb_django/bbb/templates/base.html +++ b/bbb_django/bbb/templates/base.html @@ -4,14 +4,20 @@ {% block title %}{% endblock %} {% block extrahead %}{% endblock%} - - + + + + + + + + +*/ +
diff --git a/bbb_django/bbb/templates/create.html b/bbb_django/bbb/templates/create.html index 87ce51f..7b2dedf 100644 --- a/bbb_django/bbb/templates/create.html +++ b/bbb_django/bbb/templates/create.html @@ -4,12 +4,21 @@ {% block title %}{% trans "Create a meeting" %}{% endblock %} +{% block extrahead %} + + + + + +{% endblock%} + {% block content %}

{% trans "Create Meeting" %}

{% csrf_token %} {{form}} + diff --git a/bbb_django/bbb/urls.py b/bbb_django/bbb/urls.py index 177091b..38ef60f 100644 --- a/bbb_django/bbb/urls.py +++ b/bbb_django/bbb/urls.py @@ -8,6 +8,9 @@ import settings +def i18n_javascript(request): + return admin.site.i18n_javascript(request) + urlpatterns = patterns('', url('^$', home_page, name='home'), url(r'^login/$', 'django.contrib.auth.views.login', { @@ -26,6 +29,8 @@ 'url': 'http://www.bigbluebutton.org/content/videos' , }, name='help'), + (r'^admin/jsi18n', i18n_javascript), + # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), url(r'^static/(?P.*)$', 'django.views.static.serve',{'document_root': settings.STATIC_ROOT}),