当前位置: 首页>>代码示例>>Python>>正文


Python viewutil.get_selected_event函数代码示例

本文整理汇总了Python中tracker.viewutil.get_selected_event函数的典型用法代码示例。如果您正苦于以下问题:Python get_selected_event函数的具体用法?Python get_selected_event怎么用?Python get_selected_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_selected_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_queryset

 def get_queryset(self, request):
   event = viewutil.get_selected_event(request)
   params = {}
   if not request.user.has_perm('tracker.can_edit_locked_events'):
     params['locked'] = False
   if event:
     params['event'] = event.id
   return filters.run_model_query('log', params, user=request.user, mode='admin')
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:8,代码来源:admin.py

示例2: read_donations

def read_donations(request):
  current = viewutil.get_selected_event(request);
  params = {};
  params['feed'] = 'toread';
  if current:
    params['event'] = current.id;
  donations = filters.run_model_query('donation', params, user=request.user, mode='admin');
  edit_url = reverse("admin:edit_object");
  return render(request, 'admin/read_donations.html', { 'edit_url': edit_url, 'donations': donations }); 
开发者ID:MageParts,项目名称:sda-donation-tracker-2,代码行数:9,代码来源:admin.py

示例3: select_event

def select_event(request):
  current = viewutil.get_selected_event(request)
  if request.method == 'POST':
    form = forms.EventFilterForm(data=request.POST)
    if form.is_valid():
      viewutil.set_selected_event(request, form.cleaned_data['event'])
      return redirect('admin:index')
  else:
    form = forms.EventFilterForm(**{'event': current})
  return render(request, 'admin/select_event.html', { 'form': form })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:10,代码来源:admin.py

示例4: get_query

 def get_query(self,q,request):
   params = {'q': q}
   event = viewutil.get_selected_event(request)
   if event and self.useEvent:
     params['event'] = event.id
   model = self.model
   if hasattr(self, 'modelName'):
     model = self.modelName
   if self.useLock and not request.user.has_perm('tracker.can_edit_locked_events'):
     params['locked'] = False
   return filters.run_model_query(model, params, user=request.user, mode='admin')
开发者ID:GamesDoneQuick,项目名称:donation-tracker,代码行数:11,代码来源:lookups.py

示例5: show_completed_bids

def show_completed_bids(request):
  current = viewutil.get_selected_event(request)
  params = {'feed': 'completed'}
  if current:
    params['event'] = current.id
  bids = filters.run_model_query('bid', params, user=request.user, mode='admin')
  bidList = list(bids)
  if request.method == 'POST':
    for bid in bidList:
      bid.state = 'CLOSED'
      bid.save()
      logutil.change(request, bid, u'Closed {0}'.format(unicode(bid)))
    return render(request, 'admin/completed_bids_post.html', { 'bids': bidList })
  return render(request, 'admin/completed_bids.html', { 'bids': bidList })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:14,代码来源:admin.py

示例6: automail_prize_winners

def automail_prize_winners(request):
  currentEvent = viewutil.get_selected_event(request)
  if currentEvent == None:
    return HttpResponse("Please select an event first")
  prizewinners = prizemail.prize_winners_with_email_pending(currentEvent)
  if request.method == 'POST':
    form = forms.AutomailPrizeWinnersForm(prizewinners=prizewinners, data=request.POST)
    if form.is_valid():
      prizemail.automail_prize_winners(currentEvent, form.cleaned_data['prizewinners'], form.cleaned_data['emailtemplate'], sender=form.cleaned_data['fromaddress'], replyTo=form.cleaned_data['replyaddress'])
      viewutil.tracker_log(u'prize', u'Mailed prize notifications', event=currentEvent, user=request.user)
      return render(request, 'admin/automail_prize_winners_post.html', { 'prizewinners': form.cleaned_data['prizewinners'] })
  else:
    form = forms.AutomailPrizeWinnersForm(prizewinners=prizewinners)
  return render(request, 'admin/automail_prize_winners.html', { 'form': form })
开发者ID:quinox,项目名称:sda-donation-tracker-2,代码行数:14,代码来源:admin.py

示例7: automail_prize_contributors

def automail_prize_contributors(request):
  if not hasattr(settings, 'EMAIL_HOST'):
    return HttpResponse("Email not enabled on this server.")
  currentEvent = viewutil.get_selected_event(request)
  if currentEvent == None:
    return HttpResponse("Please select an event first")
  prizes = prizemail.prizes_with_submission_email_pending(currentEvent)
  if request.method == 'POST':
    form = forms.AutomailPrizeContributorsForm(prizes=prizes, data=request.POST)
    if form.is_valid():
      prizemail.automail_prize_contributors(currentEvent, form.cleaned_data['prizes'], form.cleaned_data['emailtemplate'], sender=form.cleaned_data['fromaddress'], replyTo=form.cleaned_data['replyaddress'])
      viewutil.tracker_log(u'prize', u'Mailed prize contributors', event=currentEvent, user=request.user)
      return render(request, 'admin/automail_prize_contributors_post.html', { 'prizes': form.cleaned_data['prizes'] })
  else:
    form = forms.AutomailPrizeContributorsForm(prizes=prizes)
  return render(request, 'admin/automail_prize_contributors.html', { 'form': form, 'currentEvent': currentEvent })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:16,代码来源:admin.py

示例8: automail_prize_winners

def automail_prize_winners(request):
  if not hasattr(settings, 'EMAIL_HOST'):
    return HttpResponse("Email not enabled on this server.")
  currentEvent = viewutil.get_selected_event(request)
  if currentEvent == None:
    return HttpResponse("Please select an event first")
  prizewinners = prizemail.prize_winners_with_email_pending(currentEvent)
  if request.method == 'POST':
    form = forms.AutomailPrizeWinnersForm(prizewinners=prizewinners, data=request.POST)
    if form.is_valid():
      for prizeWinner in form.cleaned_data['prizewinners']:
        prizeWinner.acceptdeadline = form.cleaned_data['acceptdeadline']
        prizeWinner.save()
      prizemail.automail_prize_winners(currentEvent, form.cleaned_data['prizewinners'], form.cleaned_data['emailtemplate'], sender=form.cleaned_data['fromaddress'], replyTo=form.cleaned_data['replyaddress'])
      viewutil.tracker_log(u'prize', u'Mailed prize winner notifications', event=currentEvent, user=request.user)
      return render(request, 'admin/automail_prize_winners_post.html', { 'prizewinners': form.cleaned_data['prizewinners'] })
  else:
    form = forms.AutomailPrizeWinnersForm(prizewinners=prizewinners)
  return render(request, 'admin/automail_prize_winners.html', { 'form': form })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:19,代码来源:admin.py

示例9: draw_prize_winners

def draw_prize_winners(request):
  currentEvent = viewutil.get_selected_event(request)
  params = { 'feed': 'todraw' }
  if currentEvent != None:
    params['event'] = currentEvent.id
  prizes = filters.run_model_query('prize', params, user=request.user, mode='admin')
  if request.method == 'POST':
    form = forms.DrawPrizeWinnersForm(prizes=prizes, data=request.POST)
    if form.is_valid():
      for prize in form.cleaned_data['prizes']:
        status = True
        while status and not prize.maxed_winners():
          status, data = prizeutil.draw_prize(prize, seed=form.cleaned_data['seed'])
          prize.error = data['error'] if not status else ''
        logutil.change(request, prize, 'Prize Drawing')
      return render(request, 'admin/draw_prize_winners_post.html', { 'prizes': form.cleaned_data['prizes'] })
  else:
    form = forms.DrawPrizeWinnersForm(prizes=prizes)
  return render(request, 'admin/draw_prize_winners.html', { 'form': form })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:19,代码来源:admin.py

示例10: show_completed_bids

def show_completed_bids(request):
  current = viewutil.get_selected_event(request);
  params = {'state': 'OPENED'};
  if current:
    params['event'] = current.id;
  bids = filters.run_model_query('allbids', params, user=request.user, mode='admin');
  bids = viewutil.get_tree_queryset_descendants(tracker.models.Bid, bids, include_self=True).annotate(**viewutil.ModelAnnotations['bid']);
  bids = viewutil.FixupBidAnnotations(bids);
  bidList = [];
  for bidK in bids:
    bid = bids[bidK];
    if bid.state == 'OPENED' and bid.goal and bid.amount > bid.goal:
      bidList.append(bid);
  if request.method == 'POST':
    for bid in bidList:
      bid.state = 'CLOSED';
      bid.save();
    return render(request, 'admin/completed_bids_post.html', { 'bids': bidList });
  return render(request, 'admin/completed_bids.html', { 'bids': bidList });
开发者ID:MageParts,项目名称:sda-donation-tracker-2,代码行数:19,代码来源:admin.py

示例11: process_pending_bids

def process_pending_bids(request):
  currentEvent = viewutil.get_selected_event(request)
  return render(request, 'admin/process_pending_bids.html', { 'currentEvent': currentEvent })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:3,代码来源:admin.py

示例12: process_prize_submissions

def process_prize_submissions(request):
  currentEvent = viewutil.get_selected_event(request)
  return render(request, 'admin/process_prize_submissions.html', { 'currentEvent': currentEvent })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:3,代码来源:admin.py

示例13: read_donations

def read_donations(request):
  currentEvent = viewutil.get_selected_event(request)
  return render(request, 'admin/read_donations.html', { 'currentEvent': currentEvent })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:3,代码来源:admin.py

示例14: process_donations

def process_donations(request):
  currentEvent = viewutil.get_selected_event(request)
  return render(request, 'admin/process_donations.html', { 'user_can_approve': request.user.has_perm('tracker.send_to_reader'), currentEvent: currentEvent })
开发者ID:bsstephan,项目名称:donation-tracker,代码行数:3,代码来源:admin.py

示例15: queryset

 def queryset(self, request):
   event = viewutil.get_selected_event(request);
   params = {};
   if event:
     params['event'] = event.id;
   return filters.run_model_query('run', params, user=request.user, mode='admin');
开发者ID:MageParts,项目名称:sda-donation-tracker-2,代码行数:6,代码来源:admin.py


注:本文中的tracker.viewutil.get_selected_event函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。