Changelog¶
v0.27.0¶
Many-to-many fields on a Django model are now supported
Multiple partial targets
v0.26.0¶
Completely redesigned and much improved support for Django models and QuerySets.
Fix the
startunicorn
command and add some ascii art.
v0.25.0¶
Support calling functions in JavaScript modules.
Fix: use
unicorn:db
without aunicorn:model
in the same element.
v0.23.0¶
Performance enhancement that returns a 304 HTTP status code when an action happens, but the content doesn’t change.
Add
unicorn:ignore
attribute to prevent an element from being morphed (useful when usingUnicorn
with libraries likeSelect2
that change the DOM).Add support for passing arguments to
Unicorn.call
.Bug fix when attempting to cache component views that utilize the
db_model
decorator.
v0.22.0¶
Use Django cache for storing component state when available
Add support for Django 2.2.x
v0.21.0¶
Bug fix: Prevent disabled polls from firing at all.
Support
Decimal
field type.Support
dataclass
field type.Use type hints to cast fields to primitive Python types if possible.
v0.20.0¶
Add ability to exclude component view properties from JavaScript to reduce the amount of data initially rendered to the page with
javascript_exclude
.Add
complete
,rendered
,parent_rendered
component hooks.Call JavaScript functions from a component view’s method.
v0.19.0¶
Re-implemented how action method parsing is done to remove all edge cases when passing arguments to component view methods. (@frbor).
Add support for passing kwargs to component view methods.
v0.18.1¶
v0.18.0¶
Only send updated data back in the response to reduce network latency.
Experimental support for queuing up requests to alleviate race conditions when functions take a long time to process.
Use type hints on component view attributes if needed.
Bug fix: prevent race condition where an instantiated component class would be inadvertently re-used for component views that are slow to render
Bug fix: use the correct component name to call a component method from “outside” the component.
Deprecated:
DJANGO_UNICORN
setting has been renamed toUNICORN
.
v0.17.2¶
Don’t send the parent context in the response for child components that specify a partial update.
Add support for element models to specify a partial update.
Add support for polls to specify a partial update.
Handle
date
,time
,timespan
when passed as arguments from JavaScript.Render child component template’s JavaScript initialization with the parent’s as opposed to inserting a new script tag after the child component is rendered.
Bug fix: prevent an error when rendering a Django model with a date-related field, but a string value.
v0.17.1¶
Remove stray print statement.
Fix bug where child components would sometimes lose their action events.
v0.17.0¶
Target DOM changes from an action to only a portion of the DOM with partial updates.
v0.16.1¶
Remove debounce from action methods to reduce any perceived lag.
v0.16.0¶
Dirty states for when there is a change that hasn’t been synced yet.
Add support for setting multiple classes for loading states.
Attempt to handle when the component gets out of sync with an invalid checksum error.
Performance tweaks when there isn’t a change to a model or dbModel with lazy or defer modifiers.
v0.15.0¶
Add support for child components
Add discard action modifier
Add support for referring to components in a folder structure
Remove restriction that component templates must start with a div
Remove restriction that component root can’t also have
unicorn:model
orunicorn:action
v0.14.1¶
Prevent the currently focused model element from updating after the AJAX request finishes (#100).
v0.14.0¶
Disable poll with a component field
Dynamically change polling options with PollUpdate
Basic support for
pydantic
models
v0.13.0¶
Component key to allow disambiguation of components of the same name
$returnValue
special argumentGet the last action method’s return value
v0.11.2¶
v0.11.0¶
$model
special argument and decorator.$toggle
special method.Support nested properties when using the set shortcut.
Fix action string arguments that would get spaces removed inadvertently.
Breaking changes
v0.10.1¶
Use LRU cache for constructed components to prevent ever-expanding memory.
Loosen
beautifulsoup4
version requirement.Fix bug to handle floats so that they don’t lose precision when serialized to JSON.
Fix bug to handle related models (ForeignKeys, OneToOne, etc) fields in Django models.
v0.10.0¶
Add support for passing kwargs into the component on the template
Provide access to the current request in the component’s methods
v0.9.4¶
Fix: Prevent Django
CharField
form field from stripping whitespaces when used for validation.Fix: Handle edge case that would generate a null exception.
Fix: Only change loading state when an action method gets called, not on every event fire.
v0.9.3¶
Handle child elements triggering an event which should be handled by a parent unicorn element.
v0.9.1¶
Fix: certain actions weren’t triggering model values to get set correctly
v0.9.0¶
Loading states for improved UX.
$event
special argument foractions
.APPS
setting for determing where to look for components.Add support for parent elements for non-db models.
Fix: Handle if
Meta
doesn’t exist for db models.
v0.7.1¶
Fix bug where multiple actions would trigger multiple payloads.
Handle lazy models that are children of an action model better.
v0.7.0¶
Parse action method arguments as basic Python objects
Stop and prevent modifiers on actions
Defer modifier on model
Support for multiple actions on the same element
Django setting for whether the JavaScript is minified
Breaking changes
Remove unused
unicorn_styles
template tagUse dash for poll timing instead of dot
v0.6.5¶
Attempt to get the CSRF token from the cookie first before looking at the CSRF token.
v0.6.4¶
Fix bug where lazy models weren’t sending values before an action was called
Add
is_valid
method to component to more easily check if a component has validation errors.Better error message if the CSRF token is not available.
v0.6.3¶
Fix bug where model elements weren’t getting updated values when an action was being called during the same component update.
Fix bug where some action event listeners were duplicated.
v0.6.2¶
More robust fix for de-duping multiple actions.
Fix bug where conditionally added actions didn’t get an event listener.
v0.6.0¶
Realtime validation of a Unicorn model.
Polling for component updates.
v0.5.0¶
Call component method from JavaScript.
Support classes, dictionaries, Django Models, (read-only) Django QuerySets properties on a component.
Debounce modifier to change how fast changes are sent to the backend from
unicorn:model
.Lazy modifier to listen for
blur
instead ofinput
onunicorn:model
.Better support for
textarea
HTML element.
v0.4.0¶
Set shortcut for setting properties.
Listen for any valid event, not just
click
.Better handling for model updates when element ids aren’t unique.
v0.3.0¶
Add mount hook.
Add reset action.
Remove lag when typing fast in a text input and overall improved performance.
Better error handling for exceptional cases.
v0.2.0¶
Switch from
Component
class toUnicornView
to follow the conventions of class-based views.Investigate using class-based view instead of the custom Component class
v0.1.0¶
Initial version with basic functionality.