mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
More fixing to the tutorial
This commit is contained in:
parent
c1794bb17e
commit
4269745d3e
1 changed files with 2 additions and 2 deletions
|
|
@ -183,7 +183,7 @@ will_transform = (
|
|||
```{sidebar} Attributes vs database fields
|
||||
Don't confuse database fields with [Attributes](../../../Components/Attributes.md) you set via `obj.db.attr = 'foo'` or `obj.attributes.add()`. Attributes are custom database entities *linked* to an object. They are not separate fields *on* that object like `db_key` or `db_location` are.
|
||||
|
||||
While an Attribute's `db_key` is just a normal string, their `db_value` is in fact a serialized piece of data. This means that cannot query this with additional operators. So if you use e.g. `db_attributes__db_value__iexact=2`, you'll get an error. While Attributes are very flexible, this is their drawback - their stored value is not possible to directly query with advanced query methods beyond finding the exact match.
|
||||
While an Attribute's `db_key` is just a normal string, theor `db_value` is in fact a serialized piece of data. This means that cannot query this with additional operators. So if you use e.g. `db_attributes__db_value__iexact=2`, you'll get an error. While Attributes are very flexible, this is their drawback - their stored value is not possible to directly query with advanced query methods beyond finding the exact match.
|
||||
```
|
||||
- **Line 4** We want to find `Character`s, so we access `.objects` on the `Character` typeclass.
|
||||
- We start to filter ...
|
||||
|
|
@ -197,7 +197,7 @@ While an Attribute's `db_key` is just a normal string, their `db_value` is in fa
|
|||
Running this query makes our newly lycanthropic Character appear in `will_transform` so we know to transform it. Success!
|
||||
|
||||
```{important}
|
||||
You can't query for an Attribute `db_value` quite as freely as other data-types. This is because Attributes can store any Python entity and is actually stored as _strings_ on the database side. So while you can use `__eq=2` in the above example, you will not be able to `__gt=2` or `__lt=2` because these operations don't make sense for strings. See [Attributes](../../../Components/Attributes.md#querying-by-attribute) for more information on dealing with Attributes.
|
||||
You can't query for an Attribute `db_value` quite as freely as other data-types. This is because Attributes can store any Python entity and is actually stored as _strings_ on the database side. So while you can use `db_value=2` in the above example, you will not be able to use `dbvalue__eq=2` or `__lt=2`. See [Attributes](../../../Components/Attributes.md#querying-by-attribute) for more information on dealing with Attributes.
|
||||
```
|
||||
|
||||
## Queries with OR or NOT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue