Coder Social home page Coder Social logo

Comments (1)

jhackr avatar jhackr commented on August 25, 2024

I solve it by silly way
I passed ID in the url like http://127.0.0.1:8000/chat/?id=[id]
and in user list
passed id to the list

class UsersListView(LoginRequiredMixin, ListView):
    http_method_names = ['get', ]

    def get_queryset(self):
        return UserModel.objects.all().exclude(id=self.request.user.id)

    def get_user_profile(self, *args):
        usr = self.request.META['HTTP_REFERER'].rsplit('=', 1)[1]
        print(usr)
        return usr

    # def get_context_data(self, **kwargs):
    def render_to_response(self, context, **response_kwargs):
        users: List[AbstractBaseUser] = context['object_list']
        user_profile = int(self.get_user_profile())
        # print(user_profile)
        for user in users:
            if user.id == user_profile:
                data = [{
                    "username": user.get_username(),
                    "pk": str(user.pk)
                }]
                return JsonResponse(data, safe=False)

then I do jquery things to click in list then click to user then hide list..

Thank you for amazing project really I like it.

If could Implement in the easy way it will be a awasome, like make specific view takes id who want to chat with.

from django_private_chat2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.