onconova.core.serialization.ordering
Ordering
¶
Bases: Ordering
Ordering class that extends Orderingbase to provide ordering functionality for querysets or lists.
Methods¶
get_ordering(items: Union[QuerySet, List], value: Optional[str]) -> List[str] Parses a comma-separated string of field names, strips whitespace, converts them from camelCase to snake_case, and returns them as a list of strings to be used for ordering. If no value is provided, returns an empty list.
Parameters¶
items : Union[QuerySet, List] The collection of items to be ordered. Can be a Django QuerySet or a standard Python list. value : Optional[str] A comma-separated string of field names to order by.
Returns¶
List[str] A list of field names in snake_case to be used for ordering.
get_ordering(items, value)
¶
Generates a list of ordering fields from a comma-separated string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Union[QuerySet, List]
|
The collection of items to be ordered. (Not used in this method, but may be required for interface compatibility.) |
required |
|
Optional[str]
|
A comma-separated string specifying the ordering fields, possibly in camelCase. |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: A list of field names in snake_case to be used for ordering. Returns an empty list if no value is provided. |