Brought json initial data up to date; fixed addition of transaction to database; added gramps_id to reports; can now import gedcom on-line again
svn: r19545
This commit is contained in:
parent
82bcb4018c
commit
cb0d0a2c81
@ -156,6 +156,7 @@ class DbDjango(DbWriteBase, DbReadBase):
|
||||
self.undo_history_callback = None
|
||||
self.modified = 0
|
||||
self.txn = DjangoTxn("DbDjango Transaction", self)
|
||||
self.transaction = None
|
||||
# Import cache for gedcom import, uses transactions, and
|
||||
# two step adding of objects.
|
||||
self.import_cache = {}
|
||||
|
@ -829,6 +829,7 @@ class MediaRef(BaseRef):
|
||||
return "MediaRef to " + str(self.ref_object)
|
||||
|
||||
class Report(models.Model):
|
||||
gramps_id = models.TextField(blank=True, null=True)
|
||||
name = models.TextField(blank=True, null=True)
|
||||
handle = models.TextField(blank=True, null=True) # report_id
|
||||
report_type = models.TextField(blank=True, null=True)
|
||||
|
@ -157,22 +157,25 @@ breadcrumb.is_safe = True
|
||||
register.filter('breadcrumb', breadcrumb)
|
||||
|
||||
def format(string, arg0=None, arg1=None, arg2=None, arg3=None, arg4=None, arg5=None, arg6=None):
|
||||
if arg0 is None:
|
||||
try:
|
||||
if arg0 is None:
|
||||
return string
|
||||
elif arg1 is None:
|
||||
return string % arg0
|
||||
elif arg2 is None:
|
||||
return string % (arg0, arg1)
|
||||
elif arg3 is None:
|
||||
return string % (arg0, arg1, arg2)
|
||||
elif arg4 is None:
|
||||
return string % (arg0, arg1, arg2, arg3)
|
||||
elif arg5 is None:
|
||||
return string % (arg0, arg1, arg2, arg3, arg4)
|
||||
elif arg6 is None:
|
||||
return string % (arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
else:
|
||||
return string % (arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
except:
|
||||
return string
|
||||
elif arg1 is None:
|
||||
return string % arg0
|
||||
elif arg2 is None:
|
||||
return string % (arg0, arg1)
|
||||
elif arg3 is None:
|
||||
return string % (arg0, arg1, arg2)
|
||||
elif arg4 is None:
|
||||
return string % (arg0, arg1, arg2, arg3)
|
||||
elif arg5 is None:
|
||||
return string % (arg0, arg1, arg2, arg3, arg4)
|
||||
elif arg6 is None:
|
||||
return string % (arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
else:
|
||||
return string % (arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
format.is_safe = True
|
||||
register.simple_tag(format)
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
""" Main view handlers """
|
||||
|
||||
import os
|
||||
import cPickle
|
||||
import base64
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -45,6 +47,9 @@ import webapp
|
||||
from webapp.grampsdb.models import *
|
||||
from webapp.grampsdb.forms import *
|
||||
from webapp.dbdjango import DbDjango
|
||||
from webapp.libdjango import DjangoInterface
|
||||
|
||||
dji = DjangoInterface()
|
||||
|
||||
import gen.proxy
|
||||
from Utils import create_id
|
||||
@ -532,6 +537,7 @@ def view_person_detail(request, view, handle, action="view"):
|
||||
nf.model = name
|
||||
sf = SurnameForm(request.POST, instance=surname)
|
||||
if nf.is_valid() and pf.is_valid() and sf.is_valid():
|
||||
# name.preferred and surname.primary get set False in the above is_valid()
|
||||
person = pf.save()
|
||||
# Process data:
|
||||
name = nf.save(commit=False)
|
||||
@ -546,7 +552,10 @@ def view_person_detail(request, view, handle, action="view"):
|
||||
surname.primary = True # FIXME: why is this False?
|
||||
surname.save()
|
||||
# FIXME: last_saved, last_changed, last_changed_by
|
||||
# FIXME: update cache
|
||||
# FIXME: update cache:
|
||||
raw = dji.get_person(person)
|
||||
person.cache = base64.encodestring(cPickle.dumps(raw))
|
||||
person.save()
|
||||
# FIXME: update probably_alive
|
||||
return redirect("/person/%s" % person.handle)
|
||||
else: # not valid, try again:
|
||||
|
@ -65,63 +65,82 @@ for table, entries in [("grampsdb.config",
|
||||
]),
|
||||
("grampsdb.report",
|
||||
[(("name", '"Ahnentafel Report"'),
|
||||
('gramps_id', '"R0001"'),
|
||||
("handle", '"ancestor_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"birthday_report"'),
|
||||
('gramps_id', '"R0002"'),
|
||||
("handle", '"birthday_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"custom_text"'),
|
||||
('gramps_id', '"R0003"'),
|
||||
("handle", '"custom_text"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"descend_report"'),
|
||||
('gramps_id', '"R0004"'),
|
||||
("handle", '"descend_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"det_ancestor_report"'),
|
||||
('gramps_id', '"R0005"'),
|
||||
("handle", '"det_ancestor_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"det_descendant_report"'),
|
||||
('gramps_id', '"R0006"'),
|
||||
("handle", '"det_descendant_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"endofline_report"'),
|
||||
('gramps_id', '"R0007"'),
|
||||
("handle", '"endofline_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"family_group"'),
|
||||
('gramps_id', '"R0008"'),
|
||||
("handle", '"family_group"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"indiv_complete"'),
|
||||
('gramps_id', '"R0009"'),
|
||||
("handle", '"indiv_complete"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"kinship_report"'),
|
||||
('gramps_id', '"R0010"'),
|
||||
("handle", '"kinship_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"tag_report"'),
|
||||
('gramps_id', '"R0011"'),
|
||||
("handle", '"tag_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"number_of_ancestors_report"'),
|
||||
('gramps_id', '"R0012"'),
|
||||
("handle", '"number_of_ancestors_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"place_report"'),
|
||||
('gramps_id', '"R0013"'),
|
||||
("handle", '"place_report"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"simple_book_title"'),
|
||||
('gramps_id', '"R0014"'),
|
||||
("handle", '"simple_book_title"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"summary"'),
|
||||
('gramps_id', '"R0015"'),
|
||||
("handle", '"summary"'),
|
||||
("report_type", '"textreport"')),
|
||||
(("name", '"GEDCOM Export"'),
|
||||
('gramps_id', '"R0016"'),
|
||||
("handle", '"gedcom_export"'),
|
||||
("options", '"off=ged"'),
|
||||
("report_type", '"export"')),
|
||||
(("name", '"Gramps XML Export"'),
|
||||
('gramps_id', '"R0017"'),
|
||||
("handle", '"ex_gpkg"'),
|
||||
("options", '"off=gramps"'),
|
||||
("report_type", '"export"')),
|
||||
(("name", '"GEDCOM Import"'),
|
||||
('gramps_id', '"R0018"'),
|
||||
("handle", '"im_ged"'),
|
||||
("options", '"iff=ged i=http://arborvita.free.fr/Kennedy/Kennedy.ged"'),
|
||||
("report_type", '"import"')),
|
||||
(("name", '"Gramps package (portable XML) Import"'),
|
||||
('gramps_id', '"R0019"'),
|
||||
("handle", '"im_gpkg"'),
|
||||
("options", '"iff=gramps i=http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/example/gramps/example.gramps?revision=18333"'),
|
||||
("report_type", '"import"')),
|
||||
|
Loading…
Reference in New Issue
Block a user