The questions I've had during my learning process.

Id Question Solved at
1 How do you install? Solved
2 How do you start developing? Solved
3 How do you make graphics with Django? Solved
4 Django uses some kind of structure to tell the application where to look for links. How does this hierarchy work? What is actually put into the different files? Solved
5 What is the most basic way to add the url:s to urls.py? Solved
6 What is the " '^ " thing that can be seen in the URLpatterns? Solved
7 What is the $ sign in the URLpatterns? Solved
8 If I want to embed an iframe to the app can I do it straight into the HTML? Pending
9 Are all of the URLpatterns always put into the urls.py file? Pending
10 Is it difficult to change to the production server? Pending
11 How do I really get an external CSS sheet working? Pending
12 How do I connect a new app that I've created under the project folder to the project? Pending
13 What's the development process if I want to create a new website with apps? Something discovered
14 How do you cross query models? For example, If I have a blog app and a books app, how can I show related blog posts in my books app? Pending
15 How do I take the admin interface into use? Solved
16 How do I alter the models I already have? Pending
17 How do I customize what is shown and can be edited in the admin interface? Solved
18 When I want to start developing after some time, how do I start the server and check the page etc? Pending

Sunday 7 June 2009

How do I customize the admin interface.

17. How do I customize what is shown and can be edited in the admin interface?

There's quite a lot you can easily customize for the admin interface. Note that some of the changes need you to restart the database. (Ctrl-c to stop, python manage.py runserver to restart)

To customize the admin interface for a model, you need to edit the admin.py file in the app with the model for which you want the modification to be made. This is what it might look like:

from django.contrib import admin
from sky1.contract.models import ContractText, Contract

class modelNameAdmin(admin.ModelAdmin):
list_display = ('owner', 'consent', 'signDate')
list_filter = ('signDate',)
date_hierarchy = 'signDate'
ordering = ('-signDate',)
search_fields = ('firstname', 'lastname', 'signDate')

admin.site.register(ContractText)
admin.site.register(Contract, ContractAdmin)

You create a new class in the admin.py, called something like 'modelNameAdmin', then give it the parameter admin.ModelAdmin (that is standard, you don't change it)

The you have different fields you can modify! I'm not going to go through them now, but maybe I'll add something interesting later...

How do I alter the models I already have?

16. How do I alter the models I already have?

If you need to alter the models you've already made, there are two options:

1. If don't mind losing the data you already have in the database for that model you can run python manage.py reset modelName . This is of course done after you have made the changes you wanted to the model.

2. If you don't want to lose the data, you have to alter the tables manually with SQL. What you do is to go into your database server shell by running python manage.py dbshell. From there you can run normal ALTER TABLE sql commands.

Wednesday 3 June 2009

What Does A Learning Process Solve?

Knowledge capture is one of the problems that is focused on a lot. Semantics, wikipedia and search engines are some that have already improved on the state of knowledge capture. However, there are still a lot of unsolved problems.

Yesterday I had a discussion about the problem of workforce mobility. The time an employee is with a specific employer is getting shorter and shorter. This puts strain on the knowledge management. Often, a big part of the knowledge that was accumulated and that is needed for the efficient functioning of the organization is lost when someone decides to move.

Another pressing problem related to knowledge capture is resource allocation. How do you create a team that has the skill set required for a problem? This is a difficult issue in companies. Maintaining a knowledge portfolio of the company is difficult, and often people have unrecognized skills that could be relevant for the company.

The global dissemination of knowledge can also have a huge impact on society on a global scale.