From 2e9f7d6e616ba907b4745749d17648ff77ed35c5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 8 Jan 2011 02:39:43 +0100 Subject: Calendar integration --- ishtar/furnitures/context_processors.py | 1 + ishtar/furnitures/forms.py | 2 +- ishtar/furnitures/widgets.py | 13 +++++++++++++ ishtar/templates/base.html | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ishtar/furnitures/context_processors.py b/ishtar/furnitures/context_processors.py index 92e957af0..df401cda0 100644 --- a/ishtar/furnitures/context_processors.py +++ b/ishtar/furnitures/context_processors.py @@ -24,6 +24,7 @@ def get_base_context(request): dct = {} if settings.APP_NAME: dct["APP_NAME"] = settings.APP_NAME + dct["COUNTRY"] = settings.COUNTRY if 'MENU' not in request.session or \ request.session['MENU'].user != request.user: menu = Menu(request.user) diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index e6a085c07..998de126a 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -302,7 +302,7 @@ class FileForm1(forms.Form): internal_reference = forms.CharField(label=_(u"Internal reference"), max_length=60, validators=[models.is_unique(models.File, 'internal_reference')]) creation_date = forms.DateField(label=_(u"Creation date"), - initial=datetime.datetime.now) + initial=datetime.datetime.now, widget=widgets.JQueryDate) file_type = forms.ChoiceField(label=_("File type"), choices=models.FileType.get_types()) comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, diff --git a/ishtar/furnitures/widgets.py b/ishtar/furnitures/widgets.py index 8a60fba61..b7c5d7e08 100644 --- a/ishtar/furnitures/widgets.py +++ b/ishtar/furnitures/widgets.py @@ -27,6 +27,8 @@ from django.utils.simplejson import JSONEncoder from django.core.urlresolvers import resolve from django.utils.translation import ugettext_lazy as _ +from ishtar import settings + class DeleteWidget(forms.CheckboxInput): def render(self, name, value, attrs=None): final_attrs = flatatt(self.build_attrs(attrs, name=name, @@ -36,6 +38,17 @@ class DeleteWidget(forms.CheckboxInput): output.append('') return mark_safe('\n'.join(output)) +class JQueryDate(forms.TextInput): + def render(self, name, value=None, attrs=None): + rendered = super(JQueryDate, self).render(name, value, attrs) + rendered += """ + +""" % (name, settings.COUNTRY) + return rendered + + class JQueryAutoComplete(forms.TextInput): def __init__(self, source, associated_model=None, options={}, attrs={}): """ diff --git a/ishtar/templates/base.html b/ishtar/templates/base.html index 726520c54..6a1136021 100644 --- a/ishtar/templates/base.html +++ b/ishtar/templates/base.html @@ -10,6 +10,7 @@ + -- cgit v1.2.3