Have a look at the following code (available as crm1.py
). It will define the entities identified in the previous section and the result, when run, will have a familiar look:
We've added a little bit of CSS styling to order the elements on the page, but in the final revision, we will give it a much more attractive look. Clicking on the Add new button will allow you to add a new entity.
These humble beginnings in implementing CRM were accomplished by the code in crm1.py
:
Chapter8/crm1.py
import os import cherrypy from entity import AbstractEntity, Attribute, Picklist, AbstractRelation from browse import Browse from display import Display from editor import Editor from logondb import LogonDB db="/tmp/crm1.db" class Entity(AbstractEntity): database = db class Relation(AbstractRelation): database = db class User(Entity): name = Attribute(notnull=True, unique=True, displayname="Name", primary=True) class Account...