o
    lf
                     @   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   | ds	d| }t| j}z	tt||d}W n$ ty;   |ds:tjr:|d7 }tt||d}t	d| j
  Y S  w 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   APPEND_SLASHr   pathrender_flatpage)requestr   site_idf r   b/var/www/ticemtrilhas/avaliacao_env/lib/python3.10/site-packages/django/contrib/flatpages/views.pyflatpage   s   


r   c                 C   sr   |j r| jjsddlm} || jS |jrt|jt	f}nt
t	}t|j|_t|j|_t|d|i| S )z3
    Internal interface to the flat page view.
    r   )redirect_to_loginr   )registration_requireduseris_authenticateddjango.contrib.auth.viewsr   r   template_namer	   select_templateDEFAULT_TEMPLATEget_templater
   titlecontentr   render)r   r   r   templater   r   r   r   0   s   

r   N)django.confr   django.contrib.flatpages.modelsr   django.contrib.sites.shortcutsr   django.httpr   r   r   django.shortcutsr   django.templater	   django.utils.safestringr
   django.views.decorators.csrfr   r"   r   r   r   r   r   r   <module>   s    