title: How do I check if the sender is User_groups or check if the model is Group?
body: <p>I've been googling around for hours trying to figure this out. No luck. I was looking for a way to get the signal when a group has been added to a user and this works:  <a href="https://stackoverflow.com/questions/7899127/in-django-how-do-i-get-a-signal-for-when-a-group-has-a-user-added-or-removed">In Django, how do I get a signal for when a Group has a User added or removed?</a></p>
  
  <p>when I follow the directions from the question above by doing this:</p>
  
  <pre><code>@receiver(m2m_changed)
  def my_receiver(*args, **kwargs):
      import pprint
      pprint.pprint(kwargs)
      print kwargs.get('sender').__class__.__name__
  
      if kwargs.get('action') == 'post_add' and isinstance(kwargs.get('instance'), User) :#and isinstance(kwargs.get('model'), Group):
          print "here"
          ...
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>{'action': u'pre_add',
   'instance': &lt;User: GzkDg2j&gt;,
   'model': &lt;class 'django.contrib.auth.models.Group'&gt;,
   'pk_set': set([1]),
   'reverse': False,
   'sender': &lt;class 'django.contrib.auth.models.User_groups'&gt;,
   'signal': &lt;django.db.models.signals.ModelSignal object at 0x1010d5fd0&gt;,
   'using': 'default'}
  {'action': u'post_add',
   'instance': &lt;User: GzkDg2j&gt;,
   'model': &lt;class 'django.contrib.auth.models.Group'&gt;,
   'pk_set': set([1]),
   'reverse': False,
   'sender': &lt;class 'django.contrib.auth.models.User_groups'&gt;,
   'signal': &lt;django.db.models.signals.ModelSignal object at 0x1010d5fd0&gt;,
   'using': 'default'}
  </code></pre>
  
  <p>This is exactly what I want but when I try isinstance(kwargs.get('model'), Group) all hell breaks loose. The model is not an instance of Group it's an instance of ModelBase. Say What?! You can see this by printing the following</p>
  
  <pre><code>print kwargs.get('model').__class__.__name__
  </code></pre>
  
  <p>The same thing goes with sender.</p>
  
  <p>So I need to check the instance of model or sender and make sure they are either Group or User_groups.</p>