Esempio n. 1
0
def preview_front_page(request, page_id):
    """
    Preview frontpage - for administator only
    """
    pageObj = get_object_or_404(FrontPage, id=page_id)
    dateToShow = date.today()
    
    #------------ Create Objects for Hebrew Calender ----
    calLinkType     = FRONTPAGE_URL_TYPE
    calLinkTemplate = CALENDAR_URL_TYPE_REGISTRY[calLinkType]
  
    bgColorProcessor = makeHebBGColorProcessor( dateToShow )
    dayLinks = makeHebCalLinks( calLinkTemplate, engDate=date.today() )
    calender = makeHebCalRequestContext(dayLinks, engDate=date.today(),
                                           urlType=calLinkType, highlightToday=True  )
    
    return render_to_response('frontpage/frontpage.html', 
    {'content':pageObj, 'blogs': Blog.objects.all(), 'subjects' : Subject.objects.all()},
    context_instance=RequestContext(request, {}, [calender,bgColorProcessor]))
Esempio n. 2
0
          
          testDate1 = testDate + timedelta(1) #next day
          
          pageObj = FrontPage.objects.filter( date__lte=testDate1, draft=False ).latest()
          dateToShow = testDate
    except Exception, e: #In case of invalid GET string - don't do anything
        #DEBUG
        print "Exception retrieving object, reverting to today, %r"%e
        pass
  
  #------------ Create Objects for Hebrew Calender ----
  calLinkType     = FRONTPAGE_URL_TYPE
  calLinkTemplate = CALENDAR_URL_TYPE_REGISTRY[calLinkType]
  
  bgColorProcessor = makeHebBGColorProcessor( dateToShow )
  dayLinks = makeHebCalLinks( calLinkTemplate, engDate=dateToShow )
  workshopLinks = workshop_util.makeHebCalLinks(dateToShow)
  dayLinks.update(workshopLinks)
  calender = makeHebCalRequestContext(dayLinks, engDate=dateToShow, 
                            urlType=calLinkType, highlightToday=True)

  displayed_blogs = Blog.objects.filter(display_in_menu=True)

  return render_to_response('frontpage/frontpage.html', 
    {'content':pageObj, 'blogs': Blog.objects.all(),
     'subjects' : Subject.objects.all(),
     'events': WorkshopEvent.future_events(),
     'displayed_blogs': displayed_blogs
    },
    context_instance=RequestContext(request, {}, [calender,bgColorProcessor]))