2012-05-28 00:30:50 +05:30
|
|
|
#### This sets up Django so you can interact with it via the Python
|
|
|
|
#### command line.
|
|
|
|
#### Start with something like:
|
2012-05-29 04:22:23 +05:30
|
|
|
#### $ PYTHONPATH=..:../plugins/lib python -i shell.py
|
2012-05-28 00:30:50 +05:30
|
|
|
#### >>> Person.objects.all()
|
|
|
|
|
2012-05-17 08:29:37 +05:30
|
|
|
from django.conf import settings
|
|
|
|
import webapp.settings as default_settings
|
|
|
|
try:
|
|
|
|
settings.configure(default_settings)
|
|
|
|
except RuntimeError:
|
|
|
|
# already configured; ignore
|
|
|
|
pass
|
|
|
|
|
|
|
|
from webapp.grampsdb.models import *
|
2012-05-25 20:30:39 +05:30
|
|
|
from webapp.grampsdb.forms import *
|
2012-05-17 08:29:37 +05:30
|
|
|
from webapp.dbdjango import DbDjango
|
|
|
|
from webapp.reports import import_file
|
2012-05-25 20:30:39 +05:30
|
|
|
from webapp.libdjango import DjangoInterface, totime, todate
|
2012-05-26 07:18:59 +05:30
|
|
|
from gen.datehandler import displayer, parser
|
2012-05-27 19:33:17 +05:30
|
|
|
import gen.lib
|
2012-05-28 00:30:50 +05:30
|
|
|
import cli.user
|
2012-05-26 05:11:47 +05:30
|
|
|
|
2012-05-17 08:29:37 +05:30
|
|
|
db = DbDjango()
|
2012-05-19 18:41:36 +05:30
|
|
|
dji = DjangoInterface()
|
2012-05-26 07:18:59 +05:30
|
|
|
dd = displayer.display
|
|
|
|
dp = parser.parse
|
2012-05-17 08:29:37 +05:30
|
|
|
|
2012-05-28 00:30:50 +05:30
|
|
|
#import_file(db,
|
|
|
|
# "/home/dblank/gramps/trunk/example/gramps/data.gramps",
|
|
|
|
# cli.user.User())
|
2012-05-28 22:47:15 +05:30
|
|
|
|
2012-05-29 04:22:23 +05:30
|
|
|
from webapp.utils import StyledNoteFormatter
|
|
|
|
snf = StyledNoteFormatter(db)
|
|
|
|
for n in Note.objects.all():
|
|
|
|
note = db.get_note_from_handle(n.handle)
|
|
|
|
print snf.get_note_format(note)
|
|
|
|
|
|
|
|
#note = Note.objects.get(handle="aef30789d3d2090abe2")
|
|
|
|
#st = gen.lib.StyledText(note.text, dji.get_note_markup(note))
|