2016-01-18 22:24:25 +00:00
|
|
|
from project.common.views import CustomTemplate, CustomFormTemplate, MarkdownView
|
2016-01-14 20:01:47 +00:00
|
|
|
from project.common.forms import ContactForm
|
2015-10-19 13:04:49 +01:00
|
|
|
|
|
|
|
|
2015-11-25 21:11:52 +00:00
|
|
|
class IndexView(CustomTemplate):
|
2015-10-19 13:04:49 +01:00
|
|
|
template_name = 'index.html'
|
2015-11-25 21:11:52 +00:00
|
|
|
html_title = "Homepage"
|
|
|
|
body_class = "index"
|
2015-10-19 13:04:49 +01:00
|
|
|
|
2015-11-09 21:47:16 +00:00
|
|
|
|
2015-11-25 21:11:52 +00:00
|
|
|
class NoJavascriptView(CustomTemplate):
|
2015-10-19 13:04:49 +01:00
|
|
|
template_name = 'core/no-js.html'
|
|
|
|
|
2015-11-25 08:42:58 +00:00
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super().get_context_data(**kwargs)
|
2015-12-11 08:40:01 +00:00
|
|
|
context['js_redirect'] = False
|
2015-11-25 08:42:58 +00:00
|
|
|
return context
|
|
|
|
|
2015-10-19 13:04:49 +01:00
|
|
|
|
2015-11-25 21:11:52 +00:00
|
|
|
class Custom404View(CustomTemplate):
|
2015-10-19 13:04:49 +01:00
|
|
|
template_name = 'core/404.html'
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
context = self.get_context_data(**kwargs)
|
|
|
|
return self.render_to_response(context, status=404)
|
|
|
|
|
|
|
|
|
2015-11-25 21:11:52 +00:00
|
|
|
class AboutWebsiteView(CustomTemplate):
|
2015-10-19 13:04:49 +01:00
|
|
|
template_name = 'about/website.html'
|
2015-11-28 11:45:32 +00:00
|
|
|
html_title = "About website"
|
2015-10-19 13:04:49 +01:00
|
|
|
|
|
|
|
|
2016-01-14 20:01:47 +00:00
|
|
|
class AboutIndexView(CustomFormTemplate):
|
2015-11-23 18:50:14 +00:00
|
|
|
template_name = 'about/index.html'
|
2015-12-28 12:14:01 +00:00
|
|
|
html_title = "About"
|
2016-01-24 19:54:57 +00:00
|
|
|
success_url = '/about/?sent'
|
2016-01-14 20:01:47 +00:00
|
|
|
form_class = ContactForm
|
2015-12-28 12:36:05 +00:00
|
|
|
|
2016-01-24 19:54:57 +00:00
|
|
|
def form_valid(self, form):
|
|
|
|
form.send_email()
|
|
|
|
return super().form_valid(form)
|
|
|
|
|
2015-12-28 18:17:49 +00:00
|
|
|
|
2015-12-28 12:36:05 +00:00
|
|
|
class AboutMeView(CustomTemplate):
|
|
|
|
template_name = 'about/me.html'
|
|
|
|
html_title = "About Me"
|
2016-01-18 22:24:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AllProjectsView(CustomTemplate):
|
|
|
|
template_name = 'projects/all.html'
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectsView(MarkdownView):
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
self.markdown = 'projects/{0}.md'.format(kwargs['project'])
|
|
|
|
return super().dispatch(request, *args, **kwargs)
|