[Fixed]-Get the site_id of the user_id in Django?

1👍

A user does not belong to a site. A request does.

If, somehow, in your Django project sites are owned by users, then you should add a new field to your User model. Something like this:

class MyUserModel(...):
    ...
    blog = models.OneToOneField(Site)

Leave a comment