This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
django-webnodes
===============

The goal of `django-webnodes` is to create a new way of writing django templates which is fully compatible with the current django templating infrastructure.

It's born to make it easy to support standard, reusable `bussiness components` across your application.

`django-webnodes` are like special functional calls to render components of your page.

## Usage:

This use as django templatetags

{% webnode node_name [value1 value2 ... key1=value1 key2=value2 ...] %}

- ``value1``: position value passed as ``value1`` in ``get_context()`` and ``render()`` methods
- ``key1=value1``: dictionary key-value pairs passed as ``key1`` in ``get_context()`` and ``render()`` methods

## Demo

For example, if you are implementing a app statistics website, and you want to have app ratings appear on both list page and detail page, you can make an `RatingsNode` to render them on both pages.

First, create a Python module for your webnodes, e.g., webnodes.py(place it in ``yourapp`` module)

from webnodes import WebNode


class RatingsNode(WebNode):

template = 'webnodes/ratings.html'

def get_context(self, app_id):
...
ratings = ...
return {'ratings': ratings}

Calling from template:

{% load webnode %}

<p>{% webnode RatingsNode app.id %}</p>

## Extension

If you want see this webnode independently, you can add this in your urls' urlpatterns

url(r'^webnodes/', include('webnodes.ext.urls'))

Then open `http://127.0.0.1:8000/webnodes/RatingsNode?app_id=414603431` in your browser, you will see it.

## Why use this?

1. Decoupling the logic of front-end and back-end separately;
2. Make each component as a webnode will improve cohesion(because each component's template and data(include the logic of fetch data) are always strongly correlated);
3. We can test each component independently;
4. easy to realize partial renewal.

## Todos

support css and javascript

# Refs

Inspired by [tornado UI Module](https://github.com/facebook/tornado/blob/master/tornado/web.py) [django custom templatetags](https://docs.djangoproject.com/en/dev/howto/custom-template-tags/)

Based on [django-widgets(1)](https://code.google.com/p/django-widgets) and [django-widgets(2)](https://github.com/marcinn/django-widgets)
Release History

Release History

0.0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-webnodes-0.0.3.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Nov 30, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting