
    k"g
                         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
 Zed        Zy)    )settings)FlatPage)get_current_site)Http404HttpResponseHttpResponsePermanentRedirect)get_object_or_404)loader)	mark_safe)csrf_protectzflatpages/default.htmlc                 V   |j                  d      sd|z   }t        |       j                  }	 t        t        ||      }t        | |      S # t
        $ rT |j                  d      sAt        j                  r1|dz  }t        t        ||      }t        d| j                  z        cY S  w xY w)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fs       W/var/www/html/djangosite/lib/python3.12/site-packages/django/contrib/flatpages/views.pyflatpager      s     >>#Ciw'**GhCw? 7A&&  ||C X%:%:3JC!(7CA01EFFs   A AB(&B(c                    |j                   r.| j                  j                  s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   )registration_requireduseris_authenticateddjango.contrib.auth.viewsr   r   template_namer
   select_templateDEFAULT_TEMPLATEget_templater   titlecontentr   render)r   r   r   templates       r   r   r   0   s     	w||'D'D? ..))1??<L*MN&&'78
  AG!))$AIQABB    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   <module>r4      sA      4 ; L L . " - 5+ '4 C Cr*   