Skip to main content

Library to bind Django models with NiceGUI elements using DRF and SSE.

Project description

Installation:

pip install django-nice

Usage:

set these settings in your settings.py file:

from django_nice.config import Config

# Configure the base URL (host) for the API
Config.configure(host='http://your-production-server.com', api_endpoint='/api')

add these to your projects urls.py file:

from django_nice.config import Config

# Register API and SSE endpoints for a model (e.g., Data model in app 'myapp')
Config.add_urls_to_project(urlpatterns, app_label='myapp', model_name='Data')

then use inside your NiceGUI component like this:

from nicegui import ui
from django_nice.frontend import bind_element_to_model

@ui.page('/')
def index():
    textarea = ui.textarea('This is data that is bound to the django model').classes('w-full')
    bind_element_to_model(textarea, app_label='myapp', model_name='Data', pk=1, field_name='data_to_display')

ui.run()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_nice-0.1.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

django_nice-0.1.2-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file django_nice-0.1.2.tar.gz.

File metadata

  • Download URL: django_nice-0.1.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for django_nice-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ce9d488d39fe94ed609d3ae284792eb3b7cd41dbbf56e72913ba45bf01f06cf9
MD5 b78c75d3d412b178ec9e3ffda592e1b2
BLAKE2b-256 d89201ea0526071d52e95f859051ee8efbe39fd1219f3cd0e7032e1aa5fd16bf

See more details on using hashes here.

File details

Details for the file django_nice-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: django_nice-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for django_nice-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a98839b70c6f9064a1b3f5ed86d99ce507407f61ed2c1e134897a7ad0442978
MD5 bae2f46c1a3e2570d5cdc193709a48cd
BLAKE2b-256 2e4317ed5df86211ef0ad1cd59b7af772c1669e2a5efbc94f76ae4e52a823fa5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page