Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:57:43+00:00 2026-06-04T00:57:43+00:00

Want to use signal when follow() function called in UserProfile. I’ve written signal which

  • 0

Want to use signal when follow() function called in UserProfile. I’ve written signal which works with other models (on save).

class UserProfile(UserenaBaseProfile):
  user = models.OneToOneField(User,unique=True,verbose_name=_('user'))
  location = models.CharField(_('Location'), max_length=255, blank=True, default='')
  following = models.ManyToManyField(User, verbose_name=_('following'), related_name='followers', blank=True, null=True)

  def follow(self, user):
    self.following.add(user)

  def unfollow(self, user):
    self.following.remove(user)

signal

def follow_action(sender, instance, created, action_object=None, **kwargs):
  action.send(instance.user, verb='follows', target=instance.content_object)
post_save.connect(follow_action, sender=UserProfile)

this signal works when UserProfile model saved. I want to call signal when follow()function execute. will you please help? any idea? thanks alot

UPDATE:

def follows_action(sender, instance, created, action_object=None, **kwargs):
  action.send(instance.user, verb='follows', target=instance.content_object)
m2m_changed.connect(follows_action, sender=UserProfile.following.through)

It does not work. Am i missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:57:46+00:00Added an answer on June 4, 2026 at 12:57 am

    To connect a callback to a change of a many to many relation, use m2m_changed signal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use boost::signal with different function signatures and different combiners. In a class that
I want to use a class method in the signal method signal(SIGALRM, syncro); syncro
I want to use a generator as the argument passed by a PyQt4 signal,
I'm designing a declarative language for defining signal networks. I want to use variable
I use the function findpeaks from MATLAB's Signal Processing Toolbox. But everytime the function
I use signal(SIGINT,my_handler) to point SIGINT to my_handler . After some time I want
I have a function that I want to use as an event handler: void
is it possible to implement SignalR without the use of Jquery. I want to
I want use page that has this form: <form method=post action=modules.php?name=search> <input onkeypress=FKeyPress(this); onkeydown=FKeyDown(this);
I want use groovy findAll with my param to filtering closure filterClosure = {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.