Django integration for Ryzom components.
ryzom_django bridges Ryzom components with Django by providing a custom template backend, form widget integration, static asset management, and CSRF protection. It enables seamless use of Ryzom components within Django applications.
Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
'ryzom',
'ryzom_django',
]Add the template backend:
TEMPLATES = [
{
'BACKEND': 'ryzom_django.template_backend.Ryzom',
},
# ... other backends
]Register components as Django template replacements:
from ryzom.html import template, Html, Div
@template('yourapp/yourmodel_list.html', Html)
class YourModelList(Div):
def __init__(self, **context):
super().__init__(*[
P(str(obj)) for obj in context['object_list']
])Django forms automatically work with Ryzom:
# In your component
def __init__(self, **context):
super().__init__(
CSRFInput(context['view'].request),
context['form'], # BoundFields render as components
method='post',
)Generate CSS and JS bundles:
./manage.py ryzom_css # Output CSS bundle
./manage.py ryzom_js # Output JS bundle
./manage.py ryzom_bundle # Write bundle files to static- Main README for complete documentation
- ryzom for core components
- ryzom_django_mdc for Material Design form widgets