#23362 closed Cleanup/optimization (fixed)
Database Columns as "Attributes"
Reported by: | Malik A. Rumi | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I recently got an Attribute Error which told me that my type object 'Articles' has no attribute 'name'. Well, I thought that was crazy, because 'name' was the very first field on my Articles model. I did some digging in dir() on the shell, only to find out that indeed Articles did not have an attribute 'name'. Digging further, I found that it did have an 'object' called name, but these objects are not Python attributes, or perhaps, only become attributes at runtime. So where did I get the idea that they were?
https://docs.djangoproject.com/en/1.6/intro/tutorial01/
{{{# Access database columns via Python attributes.
p.question
"What's new?"
p.pub_date
datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=<UTC>)}}}
I think this language needs to be clarified. One could argue that the proper interpretation is ‘access database columns as if’, or ‘in the same style as’, rather ‘through their’(nonexistent) Python attributes.
Change History (5)
comment:1 by , 10 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 10 years ago
Replying to Tim Graham <timograham@…>:
I see you've already closed this. Thanks for at least paying attention. I was not ignoring you, just late getting back to the party. This change will probably work, but I'd like to think about it. I reserve the right to change my mind ;-). BTW, before I got into programming, I actually was a writer. I think writing about something is a good way to learn since it forces you (or at least, some people) to actually know what you are talking about. How would I get started?
comment:5 by , 10 years ago
You can read about contributing to Django's documentation in our contributing guide.
How about
# Access model field values via Python attributes.
?