o
    ÓŸŽi¤
  ã                   @   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/N)Ú
startswithr   Úidr   r   r   Úendswithr   ZAPPEND_SLASHr   ÚpathÚrender_flatpage)Úrequestr   Zsite_idÚf© r   úhC:\Users\psant\Downloads\Anu Raj Backend\school\venv\Lib\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   N)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    