title: django auto filling some data based on model attribute
body: <p>am working on a concept in which I want to capture certain information when a model is saved. To understand the full picture, I have a app core with the following model </p>
  
  <p>core/models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.contrib.contenttypes.models import ContentType
  from django.contrib.contenttypes import generic
  from transmeta import TransMeta
  from django.utils.translation import ugettext_lazy as _
  
  import signals
  
  
  class Audit(models.Model):
      ## TODO: Document
      # Polymorphic model using generic relation through DJANGO content type
      operation  = models.CharField(_('Operation'), max_length=40)
      operation_at = models.DateTimeField(_('Operation At'), auto_now_add=True)
      operation_by = models.ForeignKey(User, null=True, blank=True, related_name="%(app_label)s_%(class)s_y+")
      content_type = models.ForeignKey(ContentType)
      object_id = models.PositiveIntegerField()
      content_object = generic.GenericForeignKey('content_type', 'object_id')
  </code></pre>
  
  <p>Audit model is a generic content type, am currently attaching it with other apps such as in blog </p>
  
  <p>blog/models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.contenttypes import generic
  from django.contrib.contenttypes.models import ContentType
  from django.template.defaultfilters import slugify
  from django.utils.translation import ugettext_lazy as _
  # Create your models here.
  
  
  
      class Meta:
          verbose_name_plural = "Categories"
  
  class article(models.Model):
      title            = models.CharField(max_length=100)
      slug             = models.SlugField(editable=False, unique_for_year=True)
      content          = models.TextField()
      is_active        = models.BooleanField()
      published_at     = models.DateTimeField('Publish at',auto_now=True)
      related_articles = models.ManyToManyField('self', null=True, blank=True)
      audit_obj        = generic.GenericRelation('core.Audit', editable=False, null=True, blank=True)
  </code></pre>
  
  <p>My first attempt was, I made a post_save signal in which I was checking if the instance passed containing audit_obj attribute and then saving a record in using <code>article.audit_obj.create().save()</code>. </p>
  
  <p>Unfortunately, this did not entirely work out for me since I cannot pass the request nor I can access the request to retrieve the user information. </p>
  
  <p>So, I was thinking to create a custom signal and override the form_save method (if there is such a thing) and then using arguments to pass the request object as well as the model object. </p>
  
  <p>Any advice on how I can do that?</p>
  
  <p>Regards,</p>
  
  <p><strong>EDIT (20th of Jan, 2011):</strong></p>
  
  <p>Thanks @Yuji for your time. Well, what am trying to achieve is to keep my code as DRY as possible. What I want to do ultimately, every time I create new model, I will only create an additional attribute and name it audit_obj and I will create a single piece of code, either a signal or to override the save method inside the django core itself. The peiece of code will always check if an attribute with the following name exists and therefore creates a record in aduti table. </p>