| 63 | |
| 64 | == Errors about undefined attributes with one-char names == |
| 65 | |
| 66 | ==== Problem ==== |
| 67 | |
| 68 | You get an AttributeError with some weird attribute name that's only one char long. You don't have that attribute name anywhere in your code. |
| 69 | |
| 70 | ==== Solution ==== |
| 71 | |
| 72 | Search your model and code for situations where you have to pass a tuple of values and want to pass a tuple with one element - and that element is a string like in this sample: |
| 73 | |
| 74 | {{{ |
| 75 | #!python |
| 76 | class META: |
| 77 | ... |
| 78 | admin = meta.Admin( |
| 79 | list_display = ('total_price'), |
| 80 | ... |
| 81 | ) |
| 82 | }}} |
| 83 | |
| 84 | It's a standard python error - you are just missing a comma in the list_display assignement like this: |
| 85 | |
| 86 | {{{ |
| 87 | #!python |
| 88 | class META: |
| 89 | ... |
| 90 | admin = meta.Admin( |
| 91 | list_display = ('total_price',), |
| 92 | ... |
| 93 | ) |
| 94 | }}} |
| 95 | |
| 96 | Since a tuple is expected but a string provided, the code will merrily iterate over the characters of the string instead of the tuple elements - and that's where the single-char attribute names come from. |