I have made a model to make friends using Django model. Now I am unable to 
get the friend id through the model. The model is as follows

class Friend(models.Model):

    users = models.ManyToManyField(User) #following users

    current_user = models.ForeignKey(User, related_name='owner', 
null=True,on_delete=models.CASCADE)  #followers

    @classmethod

    def make_friend(cls, current_user, new_friend):

        friend, created = cls.objects.get_or_create(

            current_user = current_user

        )

        friend.users.add(new_friend)



    @classmethod

    def lose_friend(cls, current_user, new_friend):

        friend, created = cls.objects.get_or_create(

            current_user = current_user

        )

        friend.users.remove(new_friend)

How can I extract the friend id

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a221fa4d-6c0a-487c-8514-2b2fdcf397e2%40googlegroups.com.

Reply via email to