[TASK] Restructure a little.
This commit is contained in:
parent
a2960f4048
commit
dc8af1dbcf
|
@ -6,14 +6,13 @@ from django.contrib import admin
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
from frontend.views import login_wrap, logout_wrap
|
from frontend.views import login_wrap, logout_wrap
|
||||||
from frontend.views import IndexView, RegisterView, ProjectContextView
|
from frontend.views import IndexView, ProjectView
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^$', IndexView.as_view(), name='frontend-index'),
|
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'^login/$', login_wrap, name='frontend-login'),
|
||||||
url(r'^logout/$', logout_wrap, name='frontend-logout'),
|
url(r'^logout/$', logout_wrap, name='frontend-logout'),
|
||||||
url(r'^register/', RegisterView.as_view(), name='frontend-register'),
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
|
@ -5,9 +5,9 @@ from frontend.models import ProjectContext
|
||||||
from crispy_forms.helper import FormHelper
|
from crispy_forms.helper import FormHelper
|
||||||
from crispy_forms.layout import Submit, Layout
|
from crispy_forms.layout import Submit, Layout
|
||||||
|
|
||||||
class NewProjectContextForm(forms.ModelForm):
|
class NewProjectForm(forms.ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(NewProjectContextForm, self).__init__(*args, **kwargs)
|
super(NewProjectForm, self).__init__(*args, **kwargs)
|
||||||
self.helper = FormHelper()
|
self.helper = FormHelper()
|
||||||
self.helper.form_class = 'form-horizontal'
|
self.helper.form_class = 'form-horizontal'
|
||||||
self.helper.label_class = 'col-lg-2'
|
self.helper.label_class = 'col-lg-2'
|
||||||
|
@ -16,7 +16,7 @@ class NewProjectContextForm(forms.ModelForm):
|
||||||
self.helper.layout = Layout(
|
self.helper.layout = Layout(
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
Submit('send', 'Senden', css_class = 'btn-default')
|
Submit('send', 'Create', css_class = 'btn-default')
|
||||||
)
|
)
|
||||||
|
|
||||||
name = forms.CharField(
|
name = forms.CharField(
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
{% extends "layout/base.html" %}
|
{% extends "layout/base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<h3>Welcome, {{user}}!</h3>
|
||||||
<p>
|
<p>
|
||||||
Welcome, {{user}}!<br>
|
|
||||||
Feel free to discover.<br>
|
Feel free to discover.<br>
|
||||||
<a href="project/">Project Contexts</a>
|
<ul>
|
||||||
|
<li><a href="{% url 'frontend-projects' %}">Project Contexts</a></li>
|
||||||
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -5,4 +5,8 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>Create a new Project Context</h3>
|
<h3>Create a new Project Context</h3>
|
||||||
<p>{% crispy form %}</p>
|
<p>{% crispy form %}</p>
|
||||||
|
<h3>Existing Contexts</h3>
|
||||||
|
<p>
|
||||||
|
TABLE HERE
|
||||||
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,6 +0,0 @@
|
||||||
{% extends "layout/base.html" %}
|
|
||||||
{% block content %}
|
|
||||||
<p>
|
|
||||||
Please register here.
|
|
||||||
</p>
|
|
||||||
{% endblock %}
|
|
|
@ -6,7 +6,7 @@ from django.contrib.auth.decorators import login_required
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.contrib.auth.views import login, logout
|
from django.contrib.auth.views import login, logout
|
||||||
|
|
||||||
from frontend.forms import NewProjectContextForm
|
from frontend.forms import NewProjectForm
|
||||||
|
|
||||||
FRONTEND_PAGE_NAME = 'Citavi Mapper'
|
FRONTEND_PAGE_NAME = 'Citavi Mapper'
|
||||||
|
|
||||||
|
@ -85,15 +85,11 @@ class IndexView(ProtectedTemplateView):
|
||||||
template_name = 'index.html'
|
template_name = 'index.html'
|
||||||
page_title = 'Index'
|
page_title = 'Index'
|
||||||
|
|
||||||
class RegisterView(MyTemplateView):
|
class ProjectView(ProtectedFormView):
|
||||||
template_name = 'register.html'
|
template_name = 'projects.html'
|
||||||
page_title = 'Register'
|
page_title = 'Projects'
|
||||||
|
form_class = NewProjectForm
|
||||||
class ProjectContextView(ProtectedFormView):
|
success_url = '/projects'
|
||||||
template_name = 'projectcontext.html'
|
|
||||||
page_title = 'Project Contexts'
|
|
||||||
form_class = NewProjectContextForm
|
|
||||||
success_url = '/project'
|
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
return super(ProjectContextView, self).form_valid(form)
|
return super(ProjectView, self).form_valid(form)
|
||||||
|
|
Loading…
Reference in New Issue