This is a simplest approach possible. `as_view()` is replaced, so
that it applies the given decorator before returning.
In this approach, decorators are always put on top - that means it's not
possible to have functions called in this order:
    B.dispatch, login_required, A.dispatch
NOTE: By default this modifies the given class, so be careful when doing this:
    TemplateView = view_decorator(login_required)(TemplateView)
Because it will modify the TemplateView class. Instead create a fresh
class first and apply the decorator there. A shortcut for this is
specifying the ``subclass`` argument. But this is also dangerous. Consider:
    @view_decorator(login_required, subclass=True)
    class MyView(View):
        def get_context_data(self):
            data = super(MyView, self).get_context_data()
            data["foo"] = "bar"
            return data
This looks like a normal Python code, but there is a hidden infinite
recursion, because of how `super()` works in Python 2.x; By the time
`get_context_data()` is invoked, MyView refers to a subclass created in
the decorator. super() looks at the next class in the MRO of MyView,
which is the original MyView class we created, so it contains the
`get_context_data()` method. Which is exactly the method that was just
called. BOOM!
                
                    
                    
                    - decorator
 
                    
                    - class-based-views
 
                    
                    - decorating
 
                    
                    - cbv
 
                    
                    
                    
                 
            
            
        
        
        
            
                
                The canonical notion of urls ending in slashes dates from a web where urls were used to access documents and files this is no longer the case so keeping your urls witouth trailing slashes makes them prettier. The problem is that many people/blogs/spiders/browsers could end up with a url with slashes which can be problematic for you SEO, or confuse users.
This script is for sites with no trailing slash dicipline in their urls, and to prevent everybody getting a horrible 404 for a simple slash you just got to remove it and issue a permanent redirect (301) and you'll get your pretty urls your cake and eat it too.
I must stress, you will have to edit all your public urls removing the slashes like so:
url(r'^login$', login,}
If you forget, to edit them and visit the url, your browser will remember the redirect and you'll have to clean the browsing history to fix it.
                
                    
                    
                    - permanent redirect
 
                    
                    - no slashes
 
                    
                    - no slash
 
                    
                    
                    
                 
            
            
        
        
        
            
                
                Template filter that divides a list into an exact number of columns.
The number of columns is guaranteed.
Example (list == [1,2,3,4,5,6,7,8,9,10]):
    {% for column in list|columns:3 %}
    <ul>
        {% for item in column %}
        <li>{{ item }}</li>
        {% endfor %}
    </ul>
    {% endfor %}
Result:
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
    </ul>
    <ul>
        <li>5</li>
        <li>6</li>
        <li>7</li>
    </ul>
    <ul>
        <li>8</li>
        <li>9</li>
        <li>10</li>
    </ul>
By Davide Muzzarelli
                
                    
                    
                    - filter
 
                    
                    - template-filter
 
                    
                    - list
 
                    
                    - columns