Changes

Jump to: navigation, search

GEPS 013: Gramps Webapp

27 bytes added, 01:53, 26 November 2011
m
moved src/web to src/webapp and from web.grampsdb to webapp.grampsdb
=== Models/Views ===
Here is the model that defines the Person table from [http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/webwebapp/grampsdb/models.py?view=markup src/webwebapp/grampsdb/models.py]:
<pre>
<pre>
% cd trunk
% PYTHONPATH=src DJANGO_SETTINGS_MODEL=webwebapp.settings python >>> from webwebapp.grampsdb.models import Person
>>> Person.objects.all()
[<Person>, <Person>, ...]
</pre>
The first retrieves all of the rows for the Person table; the second retrieves just the one record that has the unique, primary key 1, and the third retrieves the single record that has the unique handle of 'gh71234dhf3746347734'. Note that we never connected onto a database... Django is (currently) define to connect on to one database, and it does it on import. The database is set in src/webwebapp/settings.py.
An alternative method of interactively talking to the database is to use ''manage.py'':
<pre>
% cd trunk/src/web webapp
% PYTHONPATH=../../src python manage.py shell
>>>
<pre>
>>> from webwebapp.grampsdb.models import *
>>> Person.objects.filter(gender_type=1)
[<Person>, <Person>, ...]
[[Image:all-tables.gif]]
To see more graphical representations of the data, run "make docs" in the src/webwebapp/ directory, and then look in src/webwebapp/docs/.
=== Templates ===
2
edits

Navigation menu