# HG changeset patch # User Pawel Solyga # Date 1232484732 0 # Node ID b1077116fe59b1710536d9bc51b80484b597cb1a # Parent 65daaf00639913ba650e02dca9ca5610aacc365c Add calendar widget support for timeline fields. Fix docstring typo in soc.views.models.timeline module. Add timeline edit template which loads necessary javascript files for datetimepicker widget. Patch by: Pawel Solyga Review by: to-be-reviewed diff -r 65daaf006399 -r b1077116fe59 app/soc/templates/soc/timeline/edit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/timeline/edit.html Tue Jan 20 20:52:12 2009 +0000 @@ -0,0 +1,33 @@ +{% extends "soc/models/edit.html" %} +{% comment %} +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +{% endcomment %} +{% block scripts %} + + + + +{% endblock %} +{% block submit_buttons %} + + + + + + +{% endblock %} \ No newline at end of file diff -r 65daaf006399 -r b1077116fe59 app/soc/views/models/timeline.py --- a/app/soc/views/models/timeline.py Tue Jan 20 20:49:49 2009 +0000 +++ b/app/soc/views/models/timeline.py Tue Jan 20 20:52:12 2009 +0000 @@ -14,16 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Views for Programs. +"""Views for Timeline. """ __authors__ = [ '"Sverre Rabbelier" ', + '"Pawel Solyga" ', ] +from google.appengine.ext import db + from django import forms +from gsoc.models import timeline from soc.logic import dicts from soc.logic.models import program as program_logic from soc.views.helper import params as params_helper @@ -46,15 +50,28 @@ new_params = {} new_params['logic'] = soc.logic.models.timeline.logic - + new_params['edit_template'] = 'soc/timeline/edit.html' new_params['name'] = "Timeline" patterns = [(r'^%(url_name)s/(?Pedit)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.edit', "Edit %(name_short)s")] + 'soc.views.models.%(module_name)s.edit', + "Edit %(name_short)s")] new_params['django_patterns_defaults'] = patterns - new_params['edit_dynafields']= [] + new_params['edit_dynafields'] = [] + + timeline_properties = timeline.Timeline.properties() + form_fields = {} + + # add class 'datetime-pick' for each DateTimeField + # this is used with datetimepicker js widget + for key, value in timeline_properties.iteritems(): + if isinstance(value, db.DateTimeProperty): + form_fields[key] = forms.DateTimeField(required=False, + widget=forms.TextInput(attrs={'class':'datetime-pick'})) + + new_params['create_extra_dynafields'] = form_fields params = dicts.merge(params, new_params)