> 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.
You actually do want to handle this in the view (or form, depending). Certainly not in the model :) Say you want to import some comments from another source at some point in the future, and you write a little custom manager command to do that. Your save() won't work, because you're trying to create objects from the command line, not via a HTTP connection, and therefore don't have a request object. The model is the python representation of the data. It shouldn't make any assumptions about its environment. Can you tell me the use case you're trying to solve here? We can figure out where that logic best "belongs". Regards Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.