From dc8af1dbcfde45086cb166d07d3671a21a77b73a Mon Sep 17 00:00:00 2001
From: Jan Philipp Timme
Date: Thu, 7 Aug 2014 14:47:59 +0200
Subject: [PATCH] [TASK] Restructure a little.
---
citavi_mapper/urls.py | 5 ++---
frontend/forms.py | 6 +++---
frontend/templates/index.html | 6 ++++--
.../{projectcontext.html => projects.html} | 4 ++++
frontend/templates/register.html | 6 ------
frontend/views.py | 18 +++++++-----------
6 files changed, 20 insertions(+), 25 deletions(-)
rename frontend/templates/{projectcontext.html => projects.html} (73%)
delete mode 100644 frontend/templates/register.html
diff --git a/citavi_mapper/urls.py b/citavi_mapper/urls.py
index badc63f..8164945 100644
--- a/citavi_mapper/urls.py
+++ b/citavi_mapper/urls.py
@@ -6,14 +6,13 @@ from django.contrib import admin
admin.autodiscover()
from frontend.views import login_wrap, logout_wrap
-from frontend.views import IndexView, RegisterView, ProjectContextView
+from frontend.views import IndexView, ProjectView
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='frontend-index'),
- url(r'^project/$', ProjectContextView.as_view(), name='frontend-projectcontext'),
+ url(r'^projects/$', ProjectView.as_view(), name='frontend-projects'),
url(r'^login/$', login_wrap, name='frontend-login'),
url(r'^logout/$', logout_wrap, name='frontend-logout'),
- url(r'^register/', RegisterView.as_view(), name='frontend-register'),
url(r'^admin/', include(admin.site.urls)),
)
\ No newline at end of file
diff --git a/frontend/forms.py b/frontend/forms.py
index 1d8d890..5239d29 100644
--- a/frontend/forms.py
+++ b/frontend/forms.py
@@ -5,9 +5,9 @@ from frontend.models import ProjectContext
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout
-class NewProjectContextForm(forms.ModelForm):
+class NewProjectForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
- super(NewProjectContextForm, self).__init__(*args, **kwargs)
+ super(NewProjectForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
@@ -16,7 +16,7 @@ class NewProjectContextForm(forms.ModelForm):
self.helper.layout = Layout(
'name',
'description',
- Submit('send', 'Senden', css_class = 'btn-default')
+ Submit('send', 'Create', css_class = 'btn-default')
)
name = forms.CharField(
diff --git a/frontend/templates/index.html b/frontend/templates/index.html
index f4ea2ce..fc2ee86 100644
--- a/frontend/templates/index.html
+++ b/frontend/templates/index.html
@@ -1,8 +1,10 @@
{% extends "layout/base.html" %}
{% block content %}
+ Welcome, {{user}}!
- Welcome, {{user}}!
Feel free to discover.
- Project Contexts
+
{% endblock %}
\ No newline at end of file
diff --git a/frontend/templates/projectcontext.html b/frontend/templates/projects.html
similarity index 73%
rename from frontend/templates/projectcontext.html
rename to frontend/templates/projects.html
index b877d91..fb44a90 100644
--- a/frontend/templates/projectcontext.html
+++ b/frontend/templates/projects.html
@@ -5,4 +5,8 @@
{% block content %}
Create a new Project Context
{% crispy form %}
+ Existing Contexts
+
+ TABLE HERE
+
{% endblock %}
\ No newline at end of file
diff --git a/frontend/templates/register.html b/frontend/templates/register.html
deleted file mode 100644
index d3eae2d..0000000
--- a/frontend/templates/register.html
+++ /dev/null
@@ -1,6 +0,0 @@
-{% extends "layout/base.html" %}
-{% block content %}
-
- Please register here.
-
-{% endblock %}
\ No newline at end of file
diff --git a/frontend/views.py b/frontend/views.py
index 6376be4..a5f595b 100644
--- a/frontend/views.py
+++ b/frontend/views.py
@@ -6,7 +6,7 @@ from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.contrib.auth.views import login, logout
-from frontend.forms import NewProjectContextForm
+from frontend.forms import NewProjectForm
FRONTEND_PAGE_NAME = 'Citavi Mapper'
@@ -85,15 +85,11 @@ class IndexView(ProtectedTemplateView):
template_name = 'index.html'
page_title = 'Index'
-class RegisterView(MyTemplateView):
- template_name = 'register.html'
- page_title = 'Register'
-
-class ProjectContextView(ProtectedFormView):
- template_name = 'projectcontext.html'
- page_title = 'Project Contexts'
- form_class = NewProjectContextForm
- success_url = '/project'
+class ProjectView(ProtectedFormView):
+ template_name = 'projects.html'
+ page_title = 'Projects'
+ form_class = NewProjectForm
+ success_url = '/projects'
def form_valid(self, form):
- return super(ProjectContextView, self).form_valid(form)
+ return super(ProjectView, self).form_valid(form)