o
    þÞh¤
  ã                   @   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   ú^/var/www/html/premium_crap/venv/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    