Releases: wq/wq.db
wq.db 2.1
wq.db 2.1.0 is the first stable release of the wq.db 2.1 series! Be sure to check out the latest documentation and the release notes for wq 2.1 when upgrading.
All changes by @sheppard.
- Built-in Mapbox Vector Tile (MVT) server for all geometry models registered with wq.db's router (de0d9e8).
- This feature currently only works when using PostGIS as a backend.
- If enabled, a
tiles
URL path will be added to the config JSON to tell @wq/map-gl where to load the geometries from.
- Option to defer loading GeoJSON geometries through REST API (171003f), particularly if they are going to be loaded via MVT instead.
- Confirm support for Python 3.12 and Django 5.0 (fcdfcf9, fbe345e)
wq.db 2.0
wq.db 2.0.0 is the first stable release of the wq.db 2.0 series! Be sure to check out the latest documentation and the release notes for wq 2.0 when upgrading.
This major release simplifies and removes some functionality in order to focus on wq.db's core functionality. See wq.db 1.3.2 if you would like a Django 4.1-compatible version of wq.db that maintains the other features of wq.db 1.3.
Changes since wq.db 2.0 alpha 2
None.
Other changes since wq.db 1.3.1
Changes in Alpha
New APIs
@register
decorator- Streamlined registration for nested models (nested_arrays argument)
Enhancements & Fixes
- Compatibilty with Django REST Framework 3.14
- Simplify user-specific config JSON
- Improve foreign key support
- Reduce extraneous database queries
- Improve fieldset configuration and JSON parsing
- Don't create URL routes for configurations registered with external=True
- Clean up code style and project layout
Removed Functionality
- Compatibility with Django 1.x-style include()
- ModelSerializer.add_lookups() and other support for Mustache templates
- wq.db.rest.context_processors & wq.db.rest.auth.context_processors
- wq.db.default_settings
- wq.db.patterns
- wq.db.rest.model_tools, wq.db.rest.models.ContentType, and wq.db.rest.migrations
- Automatic [fkname]_label serializer fields
Changes in Alpha 2
- Don't crash when ModelSerializer is used without a router
wq.db 1.3.2
wq.db 2.0 alpha 2
wq.db 2.0 alpha 2 is the second preview of the next version of wq.db, as part of the wq 2.0 alpha 2 release.
All changes by @sheppard.
- Don't crash when
ModelSerializer
is used without a router (5cf83a3)
wq.db 2.0 alpha
wq.db 2.0 alpha is a preview of the next version of wq.db, as part of the wq 2.0 alpha release. This major release includes a number of breaking changes, including the complete removal of the wq.db.patterns
module in favor of a simpler API for nested models.
Changes by @sheppard except where noted.
New APIs
@register
decorator
wq.db.rest now provides a top-level @register
decorator that directly mimics the Django admin's @register
. It is useful for creating and directly registering a custom Serializer classes:
from wq.db import rest
from .models import MyModel
@rest.register(MyModel, url="customurl")
class MyCustomSerializer(rest.ModelSerializer)
class Meta:
wq_field_config = {...}
In addition, rest.router.register()
now accepts a model as the first argument, making it more like admin.site.register()
. If the first argument is a model it will call rest.router.register_model()
, otherwise it will defer to Django REST Framework's DefaultRouter.register()
as before.
These changes were introduced in f93c4d8.
Streamlined Registration for Nested Models
The wq.db.patterns
module previously provided a number of extended serializers to facilitate registering models as "attachments" under a primary parent model. This API worked well enough but was cumbersome to use. The extended serializers (and the wq.db.patterns
module itself) have been removed in favor of a simpler API that is built into the default ModelSerializer.
from wq.db import rest
from .models import ParentModel, ChildModel
rest.router.register(
ParentModel,
nested_arrays=[ChildModel],
fields="__all__",
)
The nested_arrays
argument will automatically create a nested serializer attribute on the serializer for ParentModel.
If you need to customize the nested serializer, you can do so in one of three ways:
- Register the child model with the router as a separate top-level API with an explicit serializer. wq.app will automatically handle translating child records between ORM models and forms for the parent and child APIs.
- Register just the child serializer with
rest.router.register_serializer(ChildModel, ChildSerializer)
- Explicilty define a
ChildSeriizer
attribute on a customParentSerializer
. This is more or less how it was done before, but now both serializers can just extendwq.db.rest.ModelSerializer
rather than the separated serializers fromwq.db.patterns
.
from wq.db import rest
from .models import ParentModel, ChildModel
class ChildSerializer(rest.ModelSerializer):
class Meta:
model = ChildModel
@rest.register(ParentModel)
class ParentSerializer(rest.ModelSerializer):
children = ChildSerializer(
many=True,
wq_config={
"initial": {
"type_field": "type",
},
},
)
This change was introduced in f93c4d8 and by updating wq.db's default ModelSerializer
to extend two base classes:
NaturalKeyModelSerializer
from django-natural-keysWritableNestedModelSerializer
from drf-writable-nested
Enhancements & Fixes
- Compatibilty with Django REST Framework 3.14 (#84 by @ydf)
- Simplify user-specific config JSON to only include permissions (wq/wq#54)
- Improve foreign key support (02e889e, 9155e5b)
- Report related_name in the wq config object for use by the client ORM
- Detect DRF's
SlugRelatedField
in addition to wq.db'sLookupRelatedField
when mapping foreign key columns.
- Reduce extraneous database queries
- Remove
ContentType
proxy class in favor of additional router methods (9155e5b) - Remove automatic label generation for foreign keys (9155e5b)
- Leverage
PKOnlyObject
optimization if the ForeignKey'sto_field
is the same as the slug value. (9155e5b) - If
cache="filter"
orcache="autoupdate"
is specified without an explicitcache_filter
, return an empty response instead of the entire table (8cc1e0c)
- Remove
- Improve fieldset configuration and JSON parsing (5da66b1, 4e97e1b, b5c5e7d, aab0284)
- Don't create URL routes for configurations registered with
external=True
(7898de4) - Clean up code style and project layout (969798b, 9499bb6)
Removed Functionality
Several modules and functions have been removed. Most of these only remained for backwards compatibility with projects built with wq 1.2 and earlier versions.
- Removed
ModelSerializer.add_lookups()
and other support for Mustache templates (7556674, 02e889e)- Removed
wq.db.rest.context_processors
- Removed
wq.db.rest.auth.context_processors
- Removed
- Removed
wq.db.default_settings
(02e889e).- Take a look at wq django template 2.0 alpha to see what are settings are still relevant to wq-powered projects.
- Removed
wq.db.patterns.identify
and the rest ofwq.db.patterns
(02e889e, f93c4d8)- Use the streamlined API above instead.
- Removed compatibility with Django 1.x-style
include()
(02e889e)- If for some reason you are still calling
path('', include(rest.router.urls))
, change this to justpath('', rest.router.urls)
.
- If for some reason you are still calling
- Removed
wq.db.rest.model_tools
,wq.db.rest.models.ContentType
, andwq.db.rest.migrations
(9155e5b) - Removed automatic
[fkname]_label
serializer fields (9155e5b).- Use
fkname_label = serializers.ReadOnlyField(source='fkname.__str__')
if you were relying on this functionality.
- Use
wq.db 1.3.1
wq.db 1.3.0
wq.db 1.3.0 is the first stable release of the wq.db 1.3 series! Be sure to check out the latest documentation and the release notes for wq 1.3 when upgrading.
All changes by @sheppard.
Changes since wq.db 1.3 beta
Deployment
- Ensure compatibility with Python 3.10, Django 4.0, and Django REST Framework 3.13 (1fde1d2)
- Support loading config.js live via the REST API, in addition to the static build (wq/wq#54)
- Make
config.js
(both live and static) configurable viaWQ_CONFIG
setting (wq/wq#54) - Support the new
./manage.py deploy
command (wq/wq.build#3) - Clean up setting references (wq/wq-django-template#30)
REST API
- Support
"autoupdate"
cache setting in @wq/model (4581dc9) - Support
?field_name=null
URL filters (4581dc9) - Treat empty string as null when processing file inputs (e7033f1)
- Fix
OPTIONS
onLoginView
(e7033f1) - Support grouped choices (ddf6777)
Other changes since wq.db 1.2.2
- Changes in Alpha
- Support the new pre-built wq.js introduced in wq.app 1.3 alpha
- Changes in Beta
- Add support for
ManyToMany
foreign keys, and the xlsform"group"
type - Improve support for
FileField
,ImageField
,BooleanField
, and the xlsform"repeat"
type. - Pass
base_url
and modelordering
to client via config - Add
wq_field_config
option to facilitate overriding rendering options - Regenerate static
config.js
on reload - Improve GeoJSON content negotiation
- Add support for
wq.db 1.3 beta
wq.db 1.3 beta is a beta of the next version of wq.db, as part of the wq 1.3 beta release. This release includes additional changes to improve support for @wq/material and @wq/map-gl, as well as the pre-built wq.js provided by wq.app.
Field Improvements
- Support
ManyToMany
foreign keys (fa8fa59) - Support clearable
File
andImage
input types (#23) - Preserve label/verbose_name when rendering
BooleanField
asToggle
(9c549e0) - Support the xlsform "group" type via:
- Nested serializers with
many=False
, e.g. forOneToOne
relationships (1677135). - "Virtual" fieldsets that use the new
wq_fieldsets
option to nest JSON and UI fields for a single serializer (1598f59). - A single anonymous root fieldset for UI only (6ae7574)
- Nested serializers with
- Improve the existing support for the xlsform "repeat" type:
- Ignore
@index
attributes when determining empty status (af1b7fa)
- Ignore
- Improve support for customizing the wq field configuration:
- New
wq_field_config
andstyle={"wq_config": {}}
options (1677135) - Option to explicitly list read-only fields in the configuration (0333bff)
- New
Other Improvements
- Regenerate data/config.js whenever
./manage.py runserver
reloads (wq/wq.app#120) - Improve GeoJSON content negotiation to support @wq/map-gl (0f35c54).
- Automatically configure
base_url
for @wq/router and @wq/store (adb07be) - Include
[model].Meta.ordering
in config so it is picked up by @wq/model (9c549e0) - Move to Github Actions (3eae919, b473091)
wq.db 1.2.2
wq.db 1.2.2 confirms support for Django REST Framework 3.12 (#83 via @tomaszn). It is otherwise functionally the same as wq.db 1.2.1.
wq.db 1.3 alpha
wq.db 1.3 alpha is a preview of the next version of wq.db, as part of the wq 1.3 alpha release. This release includes minor changes to ensure compatibility with the new React renderer, as well as the pre-built ESM script provided by wq.app 1.3 alpha. In particular:
- The generated wq config object now includes
verbose_name
andverbose_name_plural
from the Django model definitions (78dab96) - The config can be dumped as ESM in addition to AMD and JSON (f441a31).
- If
settings.WQ_APP_TEMPLATE
is defined, wq.db will use file that to render all HTML views. The template is assumed to be a minimal index.html that simply loads @wq/app to do the actual rendering (f441a31).
The new wq django template automatically leverages these configuration options.