Exemplo n.º 1
0
 def post(self, request, room):
     room = Chat_group.objects.get(pk=room)
     form = GroupRoomEditForm(request.POST, instance=room)
     if form.is_valid():
         form.save()
         return redirect('chat:group_with_id', group_roomID=str(room.pk))
     return redirect('chat:home')
Exemplo n.º 2
0
 def post(self, request):
     form = GroupRoomEditForm(request.POST)
     if form.is_valid():
         form.save()
         the_last_chat = Chat_group.objects.last()
         return redirect('chat:group_with_id',
                         group_roomID=str(the_last_chat.pk))
     return redirect('chat:home')
Exemplo n.º 3
0
 def get(self, request, room):
     if room == '0':
         return redirect('chat:home')
     else:
         room = Chat_group.objects.get(pk=room)
         form = GroupRoomEditForm(user=request.user, instance=room)
         friend = Friend.objects.get(current_user=request.user)
         friends = friend.users.all()
         args = {"form": form, 'friends': friends}
         return render(request, 'chat/edit_group_room.html', args)
Exemplo n.º 4
0
    def get(self, request):

        form = GroupRoomEditForm(user=request.user,
                                 initial={'chat_admin': request.user})
        args = {"form": form}
        return render(request, 'chat/create_group_chat.html', args)
Exemplo n.º 5
0
 def get(self, request):
     form = GroupRoomEditForm()
     args = {"form": form}
     return render(request, 'chat/create_group_chat.html', args)