class HomePageView(TemplateView, NavBarMixin):
    template_name = 'home.html'
    navbar_class = MainNavBar

    def get_context_data(self, **kwargs):
        context = super(HomePageView, self).get_context_data(**kwargs)
        messages.info(self.request, 'hello http://example.com')
        return context class FormHorizontalView(FormView, NavBarMixin):
    template_name = 'form_horizontal.html'
    form_class = ContactForm
    navbar_class = MainNavBar class FormInlineView(FormView, NavBarMixin):
    template_name = 'form_inline.html'
    form_class = ContactForm
    navbar_class = MainNavBar class PaginationView(TemplateView, NavBarMixin):
    template_name = 'pagination.html'
    navbar_class = MainNavBar

    def get_context_data(self, **kwargs):
        context = super(PaginationView, self).get_context_data(**kwargs)
        lines = []
        for i in range(200):
            lines.append('Line %s' % (i + 1))
        paginator = Paginator(lines, 10)
        page = self.request.GET.get('page')
        try:
            show_lines = paginator.page(page)
        except PageNotAnInteger:
            # If page is not an integer, deliver first page.
            show_lines = paginator.page(1)
        except EmptyPage:
            # If page is out of range (e.g. 9999), deliver last page of results.
            show_lines = paginator.page(paginator.num_pages)
        context['lines'] = show_lines
        return context class FormWithFilesView(FormView, NavBarMixin):
    template_name = 'form_with_files.html'
    form_class = FilesForm
    navbar_class = MainNavBar

    def get_context_data(self, **kwargs):
        context = super(FormWithFilesView, self).get_context_data(**kwargs)
        context['layout'] = self.request.GET.get('layout', 'vertical')
        return context

    def get_initial(self):
        return {
            'file4': fieldfile,
        } class DefaultFormView(FormView, NavBarMixin):
    template_name = 'form.html'
    form_class = ContactForm
    navbar_class = MainNavBar class MiscView(TemplateView, NavBarMixin):
    template_name = 'misc.html'
    navbar_class = MainNavBar class DefaultFormsetView(FormView, NavBarMixin):
    template_name = 'formset.html'
    form_class = ContactFormSet
    navbar_class = MainNavBar class DefaultFormByFieldView(FormView, NavBarMixin):
    template_name = 'form_by_field.html'
    form_class = ContactForm
    navbar_class = MainNavBar class ButtonsView(TemplateView, NavBarMixin):
    template_name = 'buttons.html'
    navbar_class = MainNavBar class FABsView(TemplateView, NavBarMixin):
    template_name = 'fabs.html'
    navbar_class = MainNavBar class TypoView(TemplateView, NavBarMixin):
    template_name = 'typo.html'
    navbar_class = MainNavBar

    def get_context_data(self, **kwargs):
        context = super(TypoView, self).get_context_data(**kwargs)
        context['text1'] = "Propeller Heading"
        context['text2'] = "with secondary heading"
        context['text3'] = "Really large heading"
        context['text4'] = "Larger heading"
        context['text5'] = "Large heading"
        context['text6'] = "Normal heading"
        context['text7'] = "Heading"
        context['text8'] = "Lead text..."
        context['text9'] = "Normal text..."
        context['text10'] = "With this filter you can "
        context['text11'] = "highlight some text"
        context['text12'] = "strikethrough some text"
        context['text13'] = "underline some text"
        context['text14'] = "show some bold text"
        context['text15'] = "show some italic text"
        return context class NavBarView(TemplateView, NavBarMixin):
    template_name = 'navbar.html'
    navbar_class = MainNavBar

    def get_context_data(self, **kwargs):
        context = super(NavBarView, self).get_context_data(**kwargs)
        context['navbar1'] = DemoNavBar1
        context['navbar2'] = DemoNavBar2
        return context class CardView(TemplateView, NavBarMixin):
    template_name = 'cards.html'
    navbar_class = MainNavBar

    def get_context_data(self, **kwargs):
        context = super(CardView, self).get_context_data(**kwargs)
        context['card1'] = DemoCard1
        context['card2'] = DemoCard2
        context['card3'] = DemoCard3
        context['card4'] = DemoCard4
        return context
from django.conf.urls import url
from .views import HomePageView, FormHorizontalView, FormInlineView, PaginationView, FormWithFilesView, \
    DefaultFormView, MiscView, DefaultFormsetView, DefaultFormByFieldView, ButtonsView, FABsView, TypoView, NavBarView, \
    CardView
# -*- coding: utf-8 -*-
from __future__ import unicode_literals



urlpatterns = [
    url(r'^$', HomePageView.as_view(), name='home'),
    url(r'^typo$', TypoView.as_view(), name='typo'),
    url(r'^buttons$', ButtonsView.as_view(), name='buttons'),
    url(r'^fabs$', FABsView.as_view(), name='fabs'),
    url(r'^navbar$', NavBarView.as_view(), name='navbar'),
    url(r'^cards$', CardView.as_view(), name='cards'),
    url(r'^formset$', DefaultFormsetView.as_view(), name='formset_default'),
    url(r'^form$', DefaultFormView.as_view(), name='form_default'),
    url(r'^form_by_field$', DefaultFormByFieldView.as_view(), name='form_by_field'),
    url(r'^form_horizontal$', FormHorizontalView.as_view(), name='form_horizontal'),
    url(r'^form_inline$', FormInlineView.as_view(), name='form_inline'),
    url(r'^form_with_files$', FormWithFilesView.as_view(), name='form_with_files'),

    url(r'^pagination$', PaginationView.as_view(), name='pagination'),