Beispiel #1
0
  def done(self, form_list, **kwargs):
    data = {}
    for form in form_list:
      if form.is_valid():
        data.update(form.cleaned_data)

    data['author_id'] = self.request.user.pk
    # TODO: make this cleaner
    categories = data.pop('category')
    a = Activity(**data)
    a.save()
    for category in categories:
      a.category.add(category)

    return HttpResponseRedirect(get_url_by_conf('activity_list'))
Beispiel #2
0
 def post(self, request, pk, *args, **kwargs):
   activity = get_object_or_404(Activity, pk=pk)
   user = request.user
   order = user.create_order(activity)
   return HttpResponseRedirect(get_url_by_conf('order_detail', args=[order.pk]))
Beispiel #3
0
 def post(self, request, pk, *args, **kwargs):
   order = get_object_or_404(Order, pk=pk)
   #order.payed = True
   order.save()
   return HttpResponseRedirect(get_url_by_conf('order_detail', args=[order.pk]))
Beispiel #4
0
 def get(self, request, pk, *args, **kwargs):
   return HttpResponseRedirect(get_url_by_conf('activity_detail', args=[pk]))