diff -r 06d5a1dd16af docs/custom_model_fields.txt
a
|
b
|
would like to be able to things like thi
|
56 | 56 | |
57 | 57 | We assign to and retrieve from the ``hand`` attribute in our model just like |
58 | 58 | any other Python class. The trick is to tell Django how to handle saving and |
59 | | loading such an object |
| 59 | loading such an object. |
60 | 60 | |
61 | 61 | In order to use the ``Hand`` class in our models, we **do not** have to change |
62 | 62 | this class at all. This is ideal, because it means you can easily write |
… |
… |
characters by concatenating all the card
|
98 | 98 | characters by concatenating all the cards together in a pre-determined order. |
99 | 99 | Say, all the *north* cards first, then the *east*, *south* and *west* cards, in |
100 | 100 | that order. So ``Hand`` objects can be saved to text or character columns in |
101 | | the database |
| 101 | the database. |
102 | 102 | |
103 | 103 | What does a field class do? |
104 | 104 | --------------------------- |
… |
… |
Some general advice
|
549 | 549 | Some general advice |
550 | 550 | -------------------- |
551 | 551 | |
552 | | Writing a custom field can be a tricky process sometime, particularly if you |
| 552 | Writing a custom field can be a tricky process sometimes, particularly if you |
553 | 553 | are doing complex conversions between your Python types and your database and |
554 | 554 | serialization formats. A couple of tips to make things go more smoothly: |
555 | 555 | |