ķ
Žâ0_c           @   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
   Z e d    Z d S(   i˙˙˙˙(   t   settings(   t   FlatPage(   t   get_current_site(   t   Http404t   HttpResponset   HttpResponsePermanentRedirect(   t   get_object_or_404(   t   loader(   t	   mark_safe(   t   csrf_protects   flatpages/default.htmlc         C   sˇ   | j  d  s d | } n  t |   j } y t t d | d | } Wn` t k
 rŠ | j d  rŖ t j rŖ | d 7} t t d | d | } t	 d |  j
  S  n Xt |  |  S(   s3  
    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
    t   /t   urlt   sitess   %s/(   t
   startswithR   t   idR   R   R   t   endswithR    t   APPEND_SLASHR   t   patht   render_flatpage(   t   requestR   t   site_idt   f(    (    s@   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/flatpages/views.pyt   flatpage   s    
c         C   s­   | j  r3 |  j j r3 d d l m } | |  j  S| j rW t j | j t	 f  } n t j
 t	  } t | j  | _ t | j  | _ t | j i | d 6|    } | S(   s3   
    Internal interface to the flat page view.
    i˙˙˙˙(   t   redirect_to_loginR   (   t   registration_requiredt   usert   is_authenticatedt   django.contrib.auth.viewsR   R   t   template_nameR   t   select_templatet   DEFAULT_TEMPLATEt   get_templateR   t   titlet   contentR   t   render(   R   R   R   t   templatet   response(    (    s@   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/flatpages/views.pyR   0   s    	N(   t   django.confR    t   django.contrib.flatpages.modelsR   t   django.contrib.sites.shortcutsR   t   django.httpR   R   R   t   django.shortcutsR   t   django.templateR   t   django.utils.safestringR   t   django.views.decorators.csrfR	   R   R   R   (    (    (    s@   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/flatpages/views.pyt   <module>   s   	