Hey everyone. I'm trying to access the request object while overriding
the save or tapping into the post_save on a model. I need request info
when someone posts a comment. But I don't just want to handle this in
my view, I would like it to be cleaner than that, so that
functionality would remain even when i'm testing in the django admin.
Kinda stumped here. Thanks in advace!
class Comment(models.Model):
post = models.ForeignKey(Post)
author = models.ForeignKey(User, blank=True, null=True)
name = models.CharField(max_length=255)
email = models.EmailField(blank=True)
body = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.name
def save(self, *args, **kwargs):
#NEED REQUEST IN HERE
super(Comment, self).save(*args, **kwargs)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.