def post(self, request, board_id): sqlike = SqUser() form = forms.UserSearchForm(request.POST, sqlike=sqlike) board = self.me.boards.get(id=board_id, organization=self.me.default) members = self.me.default.users.all() excluded = members.exclude(boards=board) total = excluded.count() if not form.is_valid(): return render(request, 'board_app/bind-board-members.html', { 'me': self.me, 'board': board, 'count': 0, 'total': total, 'form': form }, status=400) excluded = sqlike.run(excluded) count = excluded.count() return render( request, 'board_app/bind-board-members.html', { 'excluded': excluded, 'board': board, 'me': self.me, 'organization': self.me.default, 'form': form, 'count': count, 'total': total, })
def post(self, request, group_id): sqlike = SqUser() form = forms.UserSearchForm(request.POST, sqlike=sqlike) group = self.me.groups.get(id=group_id, organization=self.me.default) users = self.me.default.users.all() excluded = users.exclude(groups=group) total = excluded.count() if not form.is_valid(): return render(request, 'group_app/bind-group-users.html', { 'me': self.me, 'group': group, 'count': 0, 'total': total, 'form': form }, status=400) excluded = sqlike.run(excluded) count = excluded.count() return render( request, 'group_app/bind-group-users.html', { 'excluded': excluded, 'group': group, 'me': self.me, 'organization': self.me.default, 'form': form, 'count': count, 'total': total, })
def post(self, request, card_id): sqlike = SqUser() form = forms.UserSearchForm(request.POST, sqlike=sqlike) card = models.Card.objects.get(id=card_id) included = card.workers.all() users = self.me.default.users.all() total = included.count() if not form.is_valid(): return render(request, 'card_app/unbind-card-workers.html', {'me': self.me, 'card': card, 'count': 0, 'total': total, 'form':form}, status=400) included = sqlike.run(included) count = included.count() return render(request, 'card_app/unbind-card-workers.html', {'included': included, 'card': card, 'me': self.me, 'organization': self.me.default,'form':form, 'count': count, 'total': total,})
def get(self, request): filter, _ = UserFilter.objects.get_or_create( user=self.me, organization=self.me.default) users = self.me.default.users.all() total = users.count() sqlike = SqUser() sqlike.feed(filter.pattern) users = sqlike.run(users) count = users.count() form = forms.UserFilterForm(instance=filter) return render( request, 'core_app/list-users.html', { 'users': users, 'owner': self.me.default.owner, 'total': total, 'form': form, 'count': count, 'organization': self.me.default })
def post(self, request): filter, _ = UserFilter.objects.get_or_create( user=self.me, organization=self.me.default) users = self.me.default.users.all() total = users.count() sqlike = SqUser() form = forms.UserFilterForm(request.POST, sqlike=sqlike, instance=filter) if not form.is_valid(): return render(request, 'core_app/list-users.html', { 'count': 0, 'owner': self.me.default.owner, 'total': total, 'form': form, 'organization': self.me.default }, status=400) form.save() users = sqlike.run(users) count = users.count() return render( request, 'core_app/list-users.html', { 'users': users, 'owner': self.me.default.owner, 'count': count, 'total': total, 'form': form, 'organization': self.me.default })