Пример #1
0
def display_workshop(request, workshop_slug, preview=False):

    # get workshop, get all workshopevents for it, get all workshopeventparts (ok - delegate)
    # render using template. add registration form at the bottom (reuse top - or just move it here)

    if( not preview ):
        workshop = get_object_or_404(Workshop, slug=workshop_slug, defining_post__draft=0)
    else:
        workshop = get_object_or_404(Workshop, slug=workshop_slug, defining_post__author=request.user.id )
      
    p = workshop.defining_post
    blog    = p.blog
    pImages = p.postimage_set.all().order_by( 'index' )
  
    #------------ Get List of flags in blog ---------
    flags = Flag.objects.filter( post__blog = blog.id ).filter( post__draft = 0 ).distinct()
      
    #------------ Create Objects for Hebrew Calender ----
    calLinkType     = FRONTPAGE_URL_TYPE
    calLinkTemplate = CALENDAR_URL_TYPE_REGISTRY[calLinkType]
  
    return generic_object_detail(
        request,
        object_id = workshop.id, #p.id,
        queryset  = Workshop.objects.all(),
        template_name = "workshop/workshop.html",
        #context_processors =[calendar,bgColorProcessor],
        extra_context = add_render_variables(
            { 'post':p, 'workshop':workshop, 'blog':blog,
            'flags':flags, 'galleryImages':pImages }, obj=p),
        template_object_name = 'post'
    )
Пример #2
0
def display_post( request, post_id, preview = False ):
  if( not preview ):
      p    = get_object_or_404(Post, id=post_id, draft=0)
  else:
      p    = get_object_or_404(Post, id=post_id, author=request.user.id )
      
  # redirect to workshop (#35)
  if p.is_workshop():
      return HttpResponseRedirect(reverse('workshop', args=[p.workshop.slug]))

  blog    = p.blog
  pImages = p.postimage_set.all().order_by( 'index' )            
  
  #-------------- Get Correct Template ----------------
  if( p.post_style == 2 ):
      template_name = "post_long.html"
  elif( p.post_style == 3 ):
      template_name = "post_gallery.html"
  else:
      template_name = "post_short.html"
      
  #------------ Get List of flags in blog ---------
  flags = Flag.objects.filter( post__blog = blog.id ).filter( post__draft = 0 ).distinct()
      
  #------------ Create Objects for Hebrew Calender ----
  calLinkType     = FRONTPAGE_URL_TYPE
  calLinkTemplate = CALENDAR_URL_TYPE_REGISTRY[calLinkType]
  
  #dateToShow = date.today()
  #bgColorProcessor = makeHebBGColorProcessor( dateToShow )
  #dayLinks = makeHebCalLinks( calLinkTemplate, date.today() )
  #calendar = makeHebCalRequestContext(dayLinks, engDate=date.today(), urlType=calLinkType, highlightToday=True)

  #-------------- Extra Info ----------------
  
  return generic_object_detail(
    request,
    object_id =  post_id,
    queryset  = Post.objects.all(),
    template_name = 'cityblog/%s'%template_name,
    #context_processors =[calendar,bgColorProcessor],
    extra_context = add_render_variables({
        'blog' : blog, 'flags' : flags, 'galleryImages': pImages }, obj=p),
    template_object_name = 'post'
  )
Пример #3
0
def object_detail(request, *args, **kwargs):
    if not request.user.is_superuser:
        return HttpResponseRedirect('/gcm/login/?next=%s' % request.path)
    return generic_object_detail(request, *args, **kwargs)
Пример #4
0
def object_detail(request, *args, **kwargs):
    if not request.user.is_superuser:
        return HttpResponseRedirect('/gcm/login/?next=%s' % request.path)
    return generic_object_detail(request, *args, **kwargs)