Fix: Calling methods with a model typehint would fail after being called multiple times (#476 by stat1c-void).
ppimport in Python 3.7.
Fix: Handle inherited (i.e. subclassed) models #459.
Fix: Include stacktrace for
Fix: Only call
updating_component functions once.
Support for loading nested components from a route that uses a class-based view.
Better support for children components.
Fix: Some types of type annotations on a component method would cause an error when it was called #392 by nerdoc.
unicorndictionary in the template context #389 by nerdoc.
Add support for raising a
ValidationErrorfrom component methods.
Fix: direct views were not caching the component correctly.
messageswhen an action method returns a redirect.
Prevent morphing or other changes when redirecting.
Fix: dictionaries in a component would generate incorrect checksums and trigger a
Checksum does not matcherror
Remove some serializations that was happening unnecessarily on every render.
Add Python 3.10 and Django 4.0 to test matrix.
Remove all blank spaces from JSON responses.
Optional support for minifying response HTML with
Log warning message if the component HTML does not appear to be well-formed (i.e. an element does not have an ending tag). #342 by liamlawless35
Bump supported Python to >=3.7.
Fix: Handle excluding a field’s attribute when the field is
Fix: Handle component classes with a
boolclass attribute and a
BooleanField. Reported by zurtri
Add direct view so that components can be added directly to urls without being required to be included in a regular Django template.
Add capability for
startunicornto create components in sub-folders. (#299)[https://github.com/adamghill/django-unicorn/issues/299]
prefetch_relatedto reduce database calls for many-to-many fields.
Explicit error messages when an invalid component field is excluded
Better support for serializing many-to-many fields which have been prefetched to reduce the number of database calls
Support excluding many-to-many fields with
Fix: Allow components to be
pickledso they can be cached.
Include request context in component templates.
Fix: nested field attributes for
Support nested field attributes for
Revert loading and dirty elements when the server returns a 304 (not modified) or a 500 error.
More verbose error messages when components can’t be loaded (nerdoc).
More complete handling to prevent XSS attacks.
Security fix: for CVE-2021-42053 to prevent XSS attacks (reported by Jeffallan).
** Breaking changes **
responses will be HTML encoded going forward (to explicitly opt-in to previous behavior use safe)
Fix: Handle when there are multiple apps sub-directories 273 by apoorvaeternity.
Fix: Make sure
visible:elementstrigger as expected in more cases.
Prevent the visible element from continuing to trigger if the visibility element method returns
Visibility event with
unicorn:pktemplate attributes are removed.
Initial prototype for component template lifecycle events.
Fix: elements after a child component would not get initialized #262 by joshiggins.
Fix: cache would fail in some instances 258.
Fix: Allow comments, blank lines, or text at the top of component templates before the root element.
Add debounce support to actions.
Determine correct path for installed app passed to
startappmanagement command if app is not already installed
Look in all
INSTALLED_APPSfor components instead of only in a
settings.APPS_DIRwhich is the default for
django-cookiecutterinstead of just
** Breaking changes **
Require an application name when running the
startunicornmanagement command for where the component should be created
Sanitize initial JSON to prevent XSS
Re-fire poll method when tab/window comes back into focus after losing visibility (https://github.com/adamghill/django-unicorn/pull/202 by frbor)
Fix bug with relationship fields on a Django model
Fix some issues with many-to-many fields on a Django model
Many-to-many fields on a Django model are now supported
Multiple partial targets
Completely redesigned and much improved support for Django models and QuerySets.
startunicorncommand and add some ascii art.
unicorn:modelin the same element.
Support custom CSRF headers set with CSRF_HEADER_NAME setting.
Performance enhancement that returns a 304 HTTP status code when an action happens, but the content doesn’t change.
unicorn:ignoreattribute to prevent an element from being morphed (useful when using
Unicornwith libraries like
Select2that change the DOM).
Add support for passing arguments to
Bug fix when attempting to cache component views that utilize the
Use Django cache for storing component state when available
Add support for Django 2.2.x
dataclassesfor Python 3.6. (@frbor)
Bug fix: Prevent disabled polls from firing at all.
Use type hints to cast fields to primitive Python types if possible.
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.
Fix regression where component kwargs were getting lost (#140, #141)
startunicornmanagement command (#142)
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.
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.
DJANGO_UNICORNsetting has been renamed to
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.
Bug fix: prevent an error when rendering a Django model with a date-related field, but a string value.
Remove stray print statement.
Fix bug where child components would sometimes lose their action events.
Target DOM changes from an action to only a portion of the DOM with partial updates.
Remove debounce from action methods to reduce any perceived lag.
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.
Fix bug where a component name has a dash in its name
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
Prevent the currently focused model element from updating after the AJAX request finishes (#100).
Disable poll with a component field
Dynamically change polling options with PollUpdate
Basic support for
Component key to allow disambiguation of components of the same name
Get the last action method’s return value
Redirect from action method in component
Fix encoding issue with default component template on Windows (#91)
Fix circular import when creating the component (#92)
Support nested properties when using the set shortcut.
Fix action string arguments that would get spaces removed inadvertently.
All existing special methods now start with a
$to signify they are magical. Therefore,
Use LRU cache for constructed components to prevent ever-expanding memory.
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.
Add support for passing kwargs into the component on the template
Provide access to the current request in the component’s methods
Fix: Prevent Django
CharFieldform 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.
Handle child elements triggering an event which should be handled by a parent unicorn element.
Fix: certain actions weren’t triggering model values to get set correctly
Loading states for improved UX.
$eventspecial argument for
APPSsetting for determing where to look for components.
Add support for parent elements for non-db models.
Fix: Handle if
Metadoesn’t exist for db models.
Add much more elaborate support for dealing with Django models.
Fix bug where multiple actions would trigger multiple payloads.
Handle lazy models that are children of an action model better.
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
Use dash for poll timing instead of dot
Attempt to get the CSRF token from the cookie first before looking at the CSRF token.
Fix bug where lazy models weren’t sending values before an action was called
is_validmethod to component to more easily check if a component has validation errors.
Better error message if the CSRF token is not available.
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.
More robust fix for de-duping multiple actions.
Fix bug where conditionally added actions didn’t get an event listener.
Fix model sync getting lost when there is an action (issue 39).
Small fix for validations.
Realtime validation of a Unicorn model.
Polling for component updates.
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
Lazy modifier to listen for
Better support for
Set shortcut for setting properties.
Listen for any valid event, not just
Better handling for model updates when element ids aren’t unique.
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.
Fix for creating default folders when running
template_nameif it’s missing in component.
startunicornDjango management command.
UnicornViewto follow the conventions of class-based views.
Investigate using class-based view instead of the custom Component class
Fix package readme and repository link.
Initial version with basic functionality.