3
g
                 @   s   d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d	Zd
d Zedd ZdS )    )settings)FlatPage)get_current_site)Http404HttpResponseHttpResponsePermanentRedirect)get_object_or_404)loader)	mark_safe)csrf_protectzflatpages/default.htmlc             C   s   |j dsd| }t| j}ytt||d}W nL tk
rz   |jd rttjrt|d7 }tt||d}t	d| j
 S  Y nX t| |S )a3  
    Public interface to the flat page view.

    Models: `flatpages.flatpages`
    Templates: Uses the template defined by the ``template_name`` field,
        or :template:`flatpages/default.html` if template_name is not defined.
    Context:
        flatpage
            `flatpages.flatpages` object
    /)urlsitesz%s/)
startswithr   idr   r   r   endswithr   ZAPPEND_SLASHr   pathrender_flatpage)requestr   Zsite_idf r   \/var/www/tester-filtro-web/env/lib/python3.6/site-packages/django/contrib/flatpages/views.pyflatpage   s    

r   c             C   st   |j r&| jj r&ddlm} || jS |jr>tj|jt	f}n
tj
t	}t|j|_t|j|_t|jd|i| S )z3
    Internal interface to the flat page view.
    r   )redirect_to_loginr   )Zregistration_requireduseris_authenticatedZdjango.contrib.auth.viewsr   r   Ztemplate_namer	   Zselect_templateDEFAULT_TEMPLATEZget_templater
   titlecontentr   render)r   r   r   templater   r   r   r   0   s    

r   N)Zdjango.confr   Zdjango.contrib.flatpages.modelsr   Zdjango.contrib.sites.shortcutsr   Zdjango.httpr   r   r   Zdjango.shortcutsr   Zdjango.templater	   Zdjango.utils.safestringr
   Zdjango.views.decorators.csrfr   r   r   r   r   r   r   r   <module>   s   