î
ªÍ X»
  ã               @   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¸   | j  d ƒ s d | } n  t |  ƒ j } y t t d | d | ƒ} Wna t k
 rª | j d ƒ r£ t j r£ | d 7} t t d | d | ƒ} t	 d |  j
 ƒ S‚  Yn Xt |  | ƒ 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   ZAPPEND_SLASHr   ÚpathÚrender_flatpage)Úrequestr   Zsite_idÚf© r   úL/home/ubuntu/projects/ifolica/build/django/django/contrib/flatpages/views.pyÚflatpage   s    
r   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)z3
    Internal interface to the flat page view.
    r   )Úredirect_to_loginr   )Zregistration_requiredÚuserZis_authenticatedZdjango.contrib.auth.viewsr   r   Ztemplate_namer	   Zselect_templateÚDEFAULT_TEMPLATEZget_templater
   ÚtitleÚcontentr   Úrender)r   r   r   ÚtemplateÚresponser   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   