These are chat archives for django/django

Oct 2017
Oct 09 2017 03:11
I am trying to create a follower system where user can get to follow investor not between user and user but between user and investor. However I am getting an error.

class Investor(models.Model):
    investor = models.ForeignKey(User, on_delete=models.CASCADE)
    name = models.CharField(max_length=200, blank=False,
                            null=False, help_text='Full Name')
    followers = models.ManyToManyField(
        User, related_name='followers', blank=True)

    def follow_investor(cls, investor, follower):
        investor, created = cls.objects.get_or_create(investor=investor)

    def unfollow_investor(cls, investor, follower):
        investor, created = cls.objects.get_or_create(investor=investor)

    views.follow_unfollow_investor, name="follow-unfollow-investor"),

def follow_unfollow_investor(request, action, slug=None):
    follower = request.user
    investor = Investor.objects.get(slug=slug)
    if action == "add":
        Investor.follow_investor(investor, follower)
    elif action == "remove":
        Investor.unfollow_investor(user, follower)
    return redirect('/')
ValueError: Cannot query "": Must be "User" instance.
Oct 09 2017 10:33
I have posted my question on SO either but waiting for help :)
Jesse Hodge
Oct 09 2017 17:30
Screen Shot 2017-10-09 at 12.27.40 PM.png
cannot for the life of me figure out why this isn't printing anything or creating the message object
Oct 09 2017 22:10
I'm looking for someone that could enlighten me with django multiprocessing