From 1093383ae03816387956b1c21e3799029fda0721 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sat, 10 Jul 2010 23:53:54 -0400 Subject: Getting project add and update working. --- snakeplan/projects/forms.py | 29 ------------- snakeplan/projects/views/projects.py | 55 +++++++++++++++--------- snakeplan/templates/base.html | 3 ++ snakeplan/templates/media/css/screen.css | 53 ++++++++++++++++++++++- snakeplan/templates/projects/iteration_list.html | 2 +- snakeplan/templates/projects/project_form.html | 14 ++++-- snakeplan/templates/projects/project_list.html | 3 +- 7 files changed, 101 insertions(+), 58 deletions(-) delete mode 100644 snakeplan/projects/forms.py diff --git a/snakeplan/projects/forms.py b/snakeplan/projects/forms.py deleted file mode 100644 index d74d9b1..0000000 --- a/snakeplan/projects/forms.py +++ /dev/null @@ -1,29 +0,0 @@ -# vim: set filencoding=utf8 -""" -SnakePlan Forms - -@author: Mike Crute (mcrute@gmail.com) -@date: July 09, 2010 -""" - -# 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. - -from django.forms import ModelForm - -import models as project_models - - -class ProjectForm(ModelForm): - - class Meta: - model = project_models.Project diff --git a/snakeplan/projects/views/projects.py b/snakeplan/projects/views/projects.py index 8fb68c8..ca61cf5 100644 --- a/snakeplan/projects/views/projects.py +++ b/snakeplan/projects/views/projects.py @@ -1,34 +1,49 @@ +# vim: set filencoding=utf8 +""" +Project Views + +@author: Mike Crute (mcrute@gmail.com) +@organization: SoftGroup Interactive, Inc. +@date: July 10, 2010 +""" + +# 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. + from django.views.generic import list_detail, create_update from django.core.urlresolvers import reverse -from snakeplan.projects.models import Project -from snakeplan.projects.models import Iteration -from snakeplan.projects.forms import ProjectForm - +from ..models import Project, Iteration def index(request): - return list_detail.object_list( - request=request, - queryset=Project.objects.order_by('-active', 'name').all(), - allow_empty=True - ) + return list_detail.object_list(request, + queryset=Project.objects.order_by('-active', 'name').all()) def project_iterations(request, project_id): project = Project.objects.get(id=project_id) - iterations = project.iteration_set.all() - return list_detail.object_list( - request=request, - queryset=iterations, - extra_context={'project_name': project}, - allow_empty=True - ) + return list_detail.object_list(request, + extra_context={'project_name': project.name }, + queryset=project.iteration_set.all()) def create_project(request): - post_save_redirect = '/project/%(id)s/' - return create_update.create_object(request, - form_class=ProjectForm, - post_save_redirect=post_save_redirect) + return create_update.create_object(request, model=Project, + post_save_redirect=reverse('project-list')) + + +def update_project(request, project_id): + return create_update.update_object(request, model=Project, + object_id=project_id, + post_save_redirect=reverse('project-list')) diff --git a/snakeplan/templates/base.html b/snakeplan/templates/base.html index 4506d5f..9ab9cac 100644 --- a/snakeplan/templates/base.html +++ b/snakeplan/templates/base.html @@ -3,6 +3,7 @@ {% block title %}{% endblock %} - SnakePlan + @@ -15,4 +16,6 @@ {% block content %}{% endblock %} + + diff --git a/snakeplan/templates/media/css/screen.css b/snakeplan/templates/media/css/screen.css index c133323..fe141c5 100644 --- a/snakeplan/templates/media/css/screen.css +++ b/snakeplan/templates/media/css/screen.css @@ -16,6 +16,11 @@ a { color: #00F; } +form, table, .action-bar { + width: 75%; + margin: auto; +} + table { margin: auto; border: 1px solid #CCC; @@ -33,12 +38,17 @@ th { border-bottom: 1px solid black; } +.copyright { + text-align: center; + font-size: 0.8em; + color: #999; +} + .row-actions { text-align: center; } .action-bar { - width: 75%; margin: 10px auto; padding: 0px; list-style: none; @@ -60,6 +70,10 @@ a.action img { vertical-align: middle; } + +/********************************************************************* + * Messages * + *********************************************************************/ div.warning { border-color: #FC3; background: #FF9 url('../images/warning.png'); @@ -84,7 +98,42 @@ div.user-notice { background-repeat: no-repeat; background-position: 20px; } - + + +/********************************************************************* + * Forms * + *********************************************************************/ +fieldset ol { + padding: 0; + list-style: none; +} + +fieldset ol li { + float: left; + clear: left; + width: 100%; + padding-bottom: 1em; +} + +fieldset label { + float: left; + width: 10em; + margin-right: 1em; + text-align: right; +} + +fieldset { + border: 0; +} + +fieldset.submit { + padding-left: 10em; +} + +fieldset legend { + display: none; +} + /********************************************************************* * Projects * diff --git a/snakeplan/templates/projects/iteration_list.html b/snakeplan/templates/projects/iteration_list.html index 4e42b52..be01bf4 100644 --- a/snakeplan/templates/projects/iteration_list.html +++ b/snakeplan/templates/projects/iteration_list.html @@ -19,7 +19,7 @@ {% for iteration in object_list %} - {{iteration.name}} + {{iteration.name}} {{iteration.description}} {{iteration.start_date}} {{iteration.end_date}} diff --git a/snakeplan/templates/projects/project_form.html b/snakeplan/templates/projects/project_form.html index 0e6a574..ca18ced 100644 --- a/snakeplan/templates/projects/project_form.html +++ b/snakeplan/templates/projects/project_form.html @@ -5,9 +5,15 @@ {% block content %}
- - +
+ Create Project +
    + {{ form.as_ul }} +
+
+ +
+ +
{% endblock %} diff --git a/snakeplan/templates/projects/project_list.html b/snakeplan/templates/projects/project_list.html index 8572bc6..85b2bb5 100644 --- a/snakeplan/templates/projects/project_list.html +++ b/snakeplan/templates/projects/project_list.html @@ -27,8 +27,7 @@ some, tags, go, here Some Iteration - Edit - Delete + Edit {% if not project.active %} Activate -- cgit v1.2.3