0

I went digging through the documentation and used pycharm to look at the documentation, but I do not understand what the line 'obj.owner' means. I believe that obj is a Django model that's being passed in. Is there a built-in attribute named 'owner' on the model object that is passed into the pre_save() method? Could someone point me to documentation this 'owner' attribute?

Thanks!

http://django-rest-framework.org/api-guide/generic-views.html#genericapiview

def pre_save(self, obj):
    """
    Set the object's owner, based on the incoming request.
    """
    obj.owner = self.request.user
user798719
  • 9,619
  • 25
  • 84
  • 123
  • 1
    What you are looking at is a static skeleton that PyCharm made. It is not the actual documentation or the actual function. I would suggest that you take a look @ the actual docs, don't care about what PyCharm says, stick to the docs. – Games Brainiac Jul 04 '13 at 16:54

1 Answers1

2

There's no automatic owner property in a Django model. That's just an example of a field you might set in that method.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • OK thanks, to be a little more general, coming from a language like Java, I'm used to being able to click on the 'object' and pull up source code, or at least know the type that 'object' is. What is the best way to duplicate that functionality in an IDE? Or is it not possible b/c there are dynamic types in Python, so we can never be fully sure what Class obj belongs to? Does knowing what type 'object' is and what field 'owner' is depend on the quality of documentation alone? – user798719 Jul 04 '13 at 18:23