Пример #1
0
 def form_valid(self, form):
     list = form.save()
     user_collaboration = UserCollaborationDetail()
     user_collaboration.user = self.request.user
     user_collaboration.list = list
     user_collaboration.is_owner = True
     user_collaboration.save()
     return HttpResponseRedirect(self.get_success_url())
Пример #2
0
 def form_valid(self, form):
     list = form.save()
     user_collaboration = UserCollaborationDetail()
     user_collaboration.user = self.request.user
     user_collaboration.list = list
     user_collaboration.is_owner = True
     user_collaboration.save()
     return HttpResponseRedirect(self.get_success_url())
Пример #3
0
    def save_list(self, data):
        try:
            list = List()
            list.title = data.get('title')
            list.save()

            user_collaboration = UserCollaborationDetail()
            user_collaboration.list = list
            user_collaboration.user = self.request.user
            user_collaboration.is_owner = True
            user_collaboration.save()

            return list, self.SAVE_SUCCESSFUL
        except Exception, e:
            return None, self.SAVE_ERROR
Пример #4
0
    def save_list(self, data):
        try:
            list = List()
            list.title = data.get("title")
            list.save()

            user_collaboration = UserCollaborationDetail()
            user_collaboration.list = list
            user_collaboration.user = self.request.user
            user_collaboration.is_owner = True
            user_collaboration.save()

            return list, self.SAVE_SUCCESSFUL
        except Exception, e:
            return None, self.SAVE_ERROR
Пример #5
0
 def form_valid(self, form):
     collaboration = UserCollaborationDetail()
     collaboration.user = form.cleaned_data["user"]
     collaboration.list = List.objects.get(pk=self.kwargs["pk"])
     collaboration.save()
     return HttpResponseRedirect(self.get_success_url())
Пример #6
0
 def form_valid(self, form):
     collaboration = UserCollaborationDetail()
     collaboration.user = form.cleaned_data["user"]
     collaboration.list = List.objects.get(pk=self.kwargs["pk"])
     collaboration.save()
     return HttpResponseRedirect(self.get_success_url())