Contribution:
pythonDjango
Headline
Web programming using the Django Framework in Language:Python
Characteristics
Django is a web framework written in Language:Python, it provides a long list of features. This contribution makes use of the template language of Django to produce html output. It supports browsing the company to view Company, Department and Employee. To make this possible, there are special urls to access them by http get. The implementation of total and cut are implemented in an object oriented style.
Illustration
The implementation adapts the object model from Contribution:py3k but adds a few more methods to add support for browsing the company:
def get dept(self, name):
return filter(bool, (d.get dept(name) for d in self.depts))[0]
def get employee(self, name):
return filter(bool, (d.get employee(name) for d in self.depts))[0]
The generation of the output is very straight forward:
def index(request):
return render to response('index.html', { 'company' : company })
def department(request, department name):
dept = company.get dept(department name)
return render to response('department.html', { 'dept' : dept })
def employee(request, employee name):
e = company.get employee(employee name)
return render to response('employee.html', { 'e' : e})
Architecture
The contribution is straightforward.
- Feature:Hierarchical companies: models.py
- Feature:Total: models.py
- Feature:Cut: models.py
- Feature:Browsing: views.py
Usage
The contribution has been tested with python 2.7 and an up-to-date version of Django.
$ python manage.py runserver
Then open localhost:8000 in your browser,
There are no revisions for this page.
User contributions
User edits
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.