First stage to bringing gramps-connect back into sync: surnames, locality in places, and marker/tag changes
svn: r16670
This commit is contained in:
parent
b31486025c
commit
90aaf57238
@ -27,11 +27,10 @@ docs:
|
|||||||
python manage.py graph_models grampsdb -i Family -o docs/family-table.png
|
python manage.py graph_models grampsdb -i Family -o docs/family-table.png
|
||||||
python manage.py graph_models grampsdb -i Person -o docs/person-table.png
|
python manage.py graph_models grampsdb -i Person -o docs/person-table.png
|
||||||
python manage.py graph_models grampsdb -o docs/all-tables.png
|
python manage.py graph_models grampsdb -o docs/all-tables.png
|
||||||
python manage.py graph_models grampsdb -i Attribute,Datamap,Name,Lds,Markup,Address,Location,Url -o docs/secondary-tables.png
|
python manage.py graph_models grampsdb -i Attribute,Datamap,Name,Lds,Tag,Address,Location,Url -o docs/secondary-tables.png
|
||||||
python manage.py graph_models grampsdb -i Person,Family,Source,Event,Repository,Place,Media,Note,Attribute,Datamap,Name,Lds,Markup,Address,Location,Url -o docs/prim-sec-tables.png
|
python manage.py graph_models grampsdb -i Person,Family,Source,Event,Repository,Place,Media,Note,Attribute,Datamap,Name,Lds,Tag,Address,Location,Url -o docs/prim-sec-tables.png
|
||||||
python manage.py graph_models grampsdb -i Person,Family,Source,Event,Repository,Place,Media,Note,Attribute,Datamap,Name,Lds,Markup,Address,Location,Url -o docs/prim-sec-tables.png
|
python manage.py graph_models grampsdb -i Person,Family,Source,Event,Repository,Place,Media,Note,Attribute,Datamap,Name,Lds,Tag,Address,Location,Url -o docs/prim-sec-tables.png
|
||||||
python manage.py graph_models grampsdb -i Person,Family,Source,Event,Repository,Place,Media,Note,Attribute,Datamap,Name,Lds,Markup,Address,Location,Url,NoteRef,SourceRef,EventRef,RepositoryRef,PersonRef,ChildRef,MediaRef -o docs/prim-sec-ref-tables.png
|
python manage.py graph_models grampsdb -i Person,Family,Source,Event,Repository,Place,Media,Note,Attribute,Datamap,Name,Lds,Tag,Address,Location,Url,NoteRef,SourceRef,EventRef,RepositoryRef,PersonRef,ChildRef,MediaRef -o docs/prim-sec-ref-tables.png
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f sqlite.db
|
rm -f sqlite.db
|
||||||
|
@ -110,13 +110,6 @@ class mGrampsType(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise IndexError("type index is out of range (use 0 or 1)")
|
raise IndexError("type index is out of range (use 0 or 1)")
|
||||||
|
|
||||||
class MarkerType(mGrampsType):
|
|
||||||
from gen.lib.markertype import MarkerType
|
|
||||||
_DATAMAP = get_datamap(MarkerType)
|
|
||||||
_CUSTOM = MarkerType._CUSTOM
|
|
||||||
_DEFAULT = _DATAMAP[MarkerType._DEFAULT]
|
|
||||||
val = models.IntegerField('marker', choices=_DATAMAP, blank=False)
|
|
||||||
|
|
||||||
class NameType(mGrampsType):
|
class NameType(mGrampsType):
|
||||||
from gen.lib.nametype import NameType
|
from gen.lib.nametype import NameType
|
||||||
_DATAMAP = get_datamap(NameType)
|
_DATAMAP = get_datamap(NameType)
|
||||||
@ -124,6 +117,13 @@ class NameType(mGrampsType):
|
|||||||
_DEFAULT = _DATAMAP[NameType._DEFAULT]
|
_DEFAULT = _DATAMAP[NameType._DEFAULT]
|
||||||
val = models.IntegerField('name type', choices=_DATAMAP, blank=False)
|
val = models.IntegerField('name type', choices=_DATAMAP, blank=False)
|
||||||
|
|
||||||
|
class NameOriginType(mGrampsType):
|
||||||
|
from gen.lib.nameorigintype import NameOriginType
|
||||||
|
_DATAMAP = get_datamap(NameOriginType)
|
||||||
|
_CUSTOM = NameOriginType._CUSTOM
|
||||||
|
_DEFAULT = _DATAMAP[NameOriginType._DEFAULT]
|
||||||
|
val = models.IntegerField('name origin type', choices=_DATAMAP, blank=False)
|
||||||
|
|
||||||
class AttributeType(mGrampsType):
|
class AttributeType(mGrampsType):
|
||||||
from gen.lib.attrtype import AttributeType
|
from gen.lib.attrtype import AttributeType
|
||||||
_DATAMAP = get_datamap(AttributeType)
|
_DATAMAP = get_datamap(AttributeType)
|
||||||
@ -381,6 +381,22 @@ class Config(models.Model):
|
|||||||
value_type = models.CharField('type of value', max_length=25)
|
value_type = models.CharField('type of value', max_length=25)
|
||||||
value = models.TextField('value')
|
value = models.TextField('value')
|
||||||
|
|
||||||
|
class Tag(models.Model):
|
||||||
|
handle = models.CharField(max_length=19, unique=True)
|
||||||
|
last_saved = models.DateTimeField('last changed', auto_now=True)
|
||||||
|
last_changed = models.DateTimeField('last changed', null=True,
|
||||||
|
blank=True) # user edits
|
||||||
|
name = models.TextField('name')
|
||||||
|
color = models.CharField(max_length=13) # "#000000000000" # Black
|
||||||
|
priority = models.IntegerField('priority', blank=False)
|
||||||
|
|
||||||
|
# Just the following have tag lists:
|
||||||
|
# ---------------------------------
|
||||||
|
#src/gen/lib/family.py
|
||||||
|
#src/gen/lib/mediaobj.py
|
||||||
|
#src/gen/lib/note.py
|
||||||
|
#src/gen/lib/person.py
|
||||||
|
|
||||||
class PrimaryObject(models.Model):
|
class PrimaryObject(models.Model):
|
||||||
"""
|
"""
|
||||||
Common attribute of all primary objects with key on the handle
|
Common attribute of all primary objects with key on the handle
|
||||||
@ -397,9 +413,6 @@ class PrimaryObject(models.Model):
|
|||||||
private = models.BooleanField('private')
|
private = models.BooleanField('private')
|
||||||
#attributes = models.ManyToManyField("Attribute", blank=True, null=True)
|
#attributes = models.ManyToManyField("Attribute", blank=True, null=True)
|
||||||
|
|
||||||
## Keys:
|
|
||||||
marker_type = models.ForeignKey('MarkerType')
|
|
||||||
|
|
||||||
def __unicode__(self): return "%s: %s" % (self.__class__.__name__,
|
def __unicode__(self): return "%s: %s" % (self.__class__.__name__,
|
||||||
self.gramps_id)
|
self.gramps_id)
|
||||||
|
|
||||||
@ -420,6 +433,8 @@ class Person(PrimaryObject):
|
|||||||
birth = models.ForeignKey("Event", related_name="birth", blank=True, null=True)
|
birth = models.ForeignKey("Event", related_name="birth", blank=True, null=True)
|
||||||
death = models.ForeignKey("Event", related_name="death", blank=True, null=True)
|
death = models.ForeignKey("Event", related_name="death", blank=True, null=True)
|
||||||
|
|
||||||
|
tags = models.ManyToManyField('Tag', blank=True, null=True)
|
||||||
|
|
||||||
# Others keys here:
|
# Others keys here:
|
||||||
# .name_set
|
# .name_set
|
||||||
# .address_set
|
# .address_set
|
||||||
@ -438,6 +453,8 @@ class Family(PrimaryObject):
|
|||||||
mother = models.ForeignKey('Person', related_name="mother_ref",
|
mother = models.ForeignKey('Person', related_name="mother_ref",
|
||||||
null=True, blank=True)
|
null=True, blank=True)
|
||||||
family_rel_type = models.ForeignKey('FamilyRelType')
|
family_rel_type = models.ForeignKey('FamilyRelType')
|
||||||
|
tags = models.ManyToManyField('Tag', blank=True, null=True)
|
||||||
|
|
||||||
#lds_list = models.ManyToManyField('Lds', null=True, blank=True)
|
#lds_list = models.ManyToManyField('Lds', null=True, blank=True)
|
||||||
|
|
||||||
# Others keys here:
|
# Others keys here:
|
||||||
@ -494,6 +511,7 @@ class Media(DateObject, PrimaryObject):
|
|||||||
references = generic.GenericRelation('MediaRef', related_name="refs",
|
references = generic.GenericRelation('MediaRef', related_name="refs",
|
||||||
content_type_field="object_type",
|
content_type_field="object_type",
|
||||||
object_id_field="object_id")
|
object_id_field="object_id")
|
||||||
|
tags = models.ManyToManyField('Tag', blank=True, null=True)
|
||||||
|
|
||||||
class Note(PrimaryObject):
|
class Note(PrimaryObject):
|
||||||
note_type = models.ForeignKey('NoteType')
|
note_type = models.ForeignKey('NoteType')
|
||||||
@ -502,6 +520,7 @@ class Note(PrimaryObject):
|
|||||||
references = generic.GenericRelation('NoteRef', related_name="refs",
|
references = generic.GenericRelation('NoteRef', related_name="refs",
|
||||||
content_type_field="object_type",
|
content_type_field="object_type",
|
||||||
object_id_field="object_id")
|
object_id_field="object_id")
|
||||||
|
tags = models.ManyToManyField('Tag', blank=True, null=True)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -522,13 +541,26 @@ class SecondaryObject(models.Model):
|
|||||||
blank=True) # user edits
|
blank=True) # user edits
|
||||||
order = models.PositiveIntegerField(default=1)
|
order = models.PositiveIntegerField(default=1)
|
||||||
|
|
||||||
|
class Surname(models.Model):
|
||||||
|
"""
|
||||||
|
Surname table, which links to name.
|
||||||
|
"""
|
||||||
|
name_origin_type = models.ForeignKey('NameOriginType',
|
||||||
|
related_name="name_origin_code",
|
||||||
|
default=2)
|
||||||
|
surname = models.TextField(blank=True)
|
||||||
|
prefix = models.TextField(blank=True)
|
||||||
|
primary = models.BooleanField('Primary surname?')
|
||||||
|
origintype = NameOriginType()
|
||||||
|
connector = models.TextField(blank=True)
|
||||||
|
name = models.ForeignKey("Name")
|
||||||
|
|
||||||
class Name(DateObject, SecondaryObject):
|
class Name(DateObject, SecondaryObject):
|
||||||
name_type = models.ForeignKey('NameType',
|
name_type = models.ForeignKey('NameType',
|
||||||
related_name="name_code",
|
related_name="name_code",
|
||||||
default=2)
|
default=2)
|
||||||
preferred = models.BooleanField('Preferred name?')
|
preferred = models.BooleanField('Preferred name?')
|
||||||
first_name = models.TextField(blank=True)
|
first_name = models.TextField(blank=True)
|
||||||
surname = models.TextField(blank=True)
|
|
||||||
suffix = models.TextField(blank=True)
|
suffix = models.TextField(blank=True)
|
||||||
title = models.TextField(blank=True)
|
title = models.TextField(blank=True)
|
||||||
prefix = models.TextField(blank=True)
|
prefix = models.TextField(blank=True)
|
||||||
@ -625,6 +657,7 @@ class Address(DateObject, SecondaryObject):
|
|||||||
|
|
||||||
class Location(models.Model):
|
class Location(models.Model):
|
||||||
street = models.TextField(blank=True)
|
street = models.TextField(blank=True)
|
||||||
|
locality = models.TextField(blank=True)
|
||||||
city = models.TextField(blank=True)
|
city = models.TextField(blank=True)
|
||||||
county = models.TextField(blank=True)
|
county = models.TextField(blank=True)
|
||||||
state = models.TextField(blank=True)
|
state = models.TextField(blank=True)
|
||||||
@ -737,9 +770,8 @@ class MediaRef(BaseRef):
|
|||||||
|
|
||||||
TABLES = [
|
TABLES = [
|
||||||
("abstract", mGrampsType),
|
("abstract", mGrampsType),
|
||||||
("type", MarkerType),
|
|
||||||
("type", MarkupType),
|
|
||||||
("type", NameType),
|
("type", NameType),
|
||||||
|
("type", NameOriginType),
|
||||||
("type", NameFormatType),
|
("type", NameFormatType),
|
||||||
("type", AttributeType),
|
("type", AttributeType),
|
||||||
("type", UrlType),
|
("type", UrlType),
|
||||||
|
@ -31,8 +31,8 @@ import os
|
|||||||
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"
|
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
from gen.lib.markertype import MarkerType
|
|
||||||
from gen.lib.nametype import NameType
|
from gen.lib.nametype import NameType
|
||||||
|
from gen.lib.nameorigintype import NameOriginType
|
||||||
from gen.lib.attrtype import AttributeType
|
from gen.lib.attrtype import AttributeType
|
||||||
from gen.lib.urltype import UrlType
|
from gen.lib.urltype import UrlType
|
||||||
from gen.lib.childreftype import ChildRefType
|
from gen.lib.childreftype import ChildRefType
|
||||||
@ -44,7 +44,7 @@ from gen.lib.eventroletype import EventRoleType
|
|||||||
from gen.lib.notetype import NoteType
|
from gen.lib.notetype import NoteType
|
||||||
|
|
||||||
from grampsdb.models import (GenderType, LdsType, LdsStatus,
|
from grampsdb.models import (GenderType, LdsType, LdsStatus,
|
||||||
NameFormatType, ThemeType)
|
NameFormatType, NameOriginType, ThemeType)
|
||||||
|
|
||||||
def get_datamap(x):
|
def get_datamap(x):
|
||||||
"""
|
"""
|
||||||
@ -85,7 +85,7 @@ for table, entries in [("grampsdb.config",
|
|||||||
|
|
||||||
## Add the data for the type models:
|
## Add the data for the type models:
|
||||||
|
|
||||||
type_models = [MarkerType, NameType, AttributeType, UrlType, ChildRefType,
|
type_models = [NameType, NameOriginType, AttributeType, UrlType, ChildRefType,
|
||||||
RepositoryType, EventType, FamilyRelType, SourceMediaType,
|
RepositoryType, EventType, FamilyRelType, SourceMediaType,
|
||||||
EventRoleType, NoteType, GenderType, LdsType, LdsStatus,
|
EventRoleType, NoteType, GenderType, LdsType, LdsStatus,
|
||||||
NameFormatType]
|
NameFormatType]
|
||||||
|
@ -253,7 +253,6 @@ class DjangoInterface(object):
|
|||||||
the_type = tuple(event.event_type)
|
the_type = tuple(event.event_type)
|
||||||
description = event.description
|
description = event.description
|
||||||
change = totime(event.last_changed)
|
change = totime(event.last_changed)
|
||||||
marker = tuple(event.marker_type)
|
|
||||||
private = event.private
|
private = event.private
|
||||||
note_list = self.get_note_list(event)
|
note_list = self.get_note_list(event)
|
||||||
source_list = self.get_source_ref_list(event)
|
source_list = self.get_source_ref_list(event)
|
||||||
@ -263,7 +262,7 @@ class DjangoInterface(object):
|
|||||||
place = self.get_place_handle(event)
|
place = self.get_place_handle(event)
|
||||||
return (str(handle), gid, the_type, date, description, place,
|
return (str(handle), gid, the_type, date, description, place,
|
||||||
source_list, note_list, media_list, attribute_list,
|
source_list, note_list, media_list, attribute_list,
|
||||||
change, marker, private)
|
change, private)
|
||||||
|
|
||||||
def get_note(self, note):
|
def get_note(self, note):
|
||||||
styled_text = [note.text, []]
|
styled_text = [note.text, []]
|
||||||
@ -281,7 +280,7 @@ class DjangoInterface(object):
|
|||||||
note.preformatted,
|
note.preformatted,
|
||||||
tuple(note.note_type),
|
tuple(note.note_type),
|
||||||
changed,
|
changed,
|
||||||
tuple(note.marker_type),
|
tuple(note.tag_list),
|
||||||
note.private)
|
note.private)
|
||||||
|
|
||||||
def get_family(self, family):
|
def get_family(self, family):
|
||||||
@ -307,7 +306,7 @@ class DjangoInterface(object):
|
|||||||
attribute_list, lds_seal_list,
|
attribute_list, lds_seal_list,
|
||||||
source_list, note_list,
|
source_list, note_list,
|
||||||
totime(family.last_changed),
|
totime(family.last_changed),
|
||||||
tuple(family.marker_type),
|
tuple(family.tag_list),
|
||||||
family.private)
|
family.private)
|
||||||
|
|
||||||
def get_repository(self, repository):
|
def get_repository(self, repository):
|
||||||
@ -322,7 +321,6 @@ class DjangoInterface(object):
|
|||||||
address_list,
|
address_list,
|
||||||
url_list,
|
url_list,
|
||||||
totime(repository.last_changed),
|
totime(repository.last_changed),
|
||||||
tuple(repository.marker_type),
|
|
||||||
repository.private)
|
repository.private)
|
||||||
|
|
||||||
def get_source(self, source):
|
def get_source(self, source):
|
||||||
@ -341,7 +339,6 @@ class DjangoInterface(object):
|
|||||||
totime(source.last_changed),
|
totime(source.last_changed),
|
||||||
datamap,
|
datamap,
|
||||||
reporef_list,
|
reporef_list,
|
||||||
tuple(source.marker_type),
|
|
||||||
source.private)
|
source.private)
|
||||||
|
|
||||||
def get_media(self, media):
|
def get_media(self, media):
|
||||||
@ -359,7 +356,7 @@ class DjangoInterface(object):
|
|||||||
note_list,
|
note_list,
|
||||||
totime(media.last_changed),
|
totime(media.last_changed),
|
||||||
date,
|
date,
|
||||||
tuple(media.marker_type),
|
tuple(media.tag_list),
|
||||||
media.private)
|
media.private)
|
||||||
|
|
||||||
def get_person(self, person):
|
def get_person(self, person):
|
||||||
@ -399,7 +396,7 @@ class DjangoInterface(object):
|
|||||||
psource_list,
|
psource_list,
|
||||||
pnote_list,
|
pnote_list,
|
||||||
totime(person.last_changed),
|
totime(person.last_changed),
|
||||||
tuple(person.marker_type),
|
tuple(person.tag_list),
|
||||||
person.private,
|
person.private,
|
||||||
person_ref_list)
|
person_ref_list)
|
||||||
|
|
||||||
@ -443,7 +440,6 @@ class DjangoInterface(object):
|
|||||||
source_list,
|
source_list,
|
||||||
note_list,
|
note_list,
|
||||||
totime(place.last_changed),
|
totime(place.last_changed),
|
||||||
tuple(place.marker_type),
|
|
||||||
place.private)
|
place.private)
|
||||||
|
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
@ -552,23 +548,25 @@ class DjangoInterface(object):
|
|||||||
source.abbrev,
|
source.abbrev,
|
||||||
totime(last_changed), datamap,
|
totime(last_changed), datamap,
|
||||||
reporef_list,
|
reporef_list,
|
||||||
tuple(source.marker_type), source.private)
|
source.private)
|
||||||
|
|
||||||
def pack_name(self, name):
|
def pack_name(self, name):
|
||||||
source_list = self.get_source_ref_list(name)
|
source_list = self.get_source_ref_list(name)
|
||||||
note_list = self.get_note_list(name)
|
note_list = self.get_note_list(name)
|
||||||
date = self.get_date(name)
|
date = self.get_date(name)
|
||||||
return (name.private, source_list, note_list, date,
|
return (name.private, source_list, note_list, date,
|
||||||
name.first_name, name.surname, name.suffix, name.title,
|
name.first_name, name.surname_list, name.suffix,
|
||||||
tuple(name.name_type), name.prefix, name.patronymic,
|
name.title, tuple(name.name_type),
|
||||||
name.group_as, name.sort_as.val, name.display_as.val, name.call)
|
name.group_as, name.sort_as.val,
|
||||||
|
name.display_as.val, name.call, name.nick,
|
||||||
|
name.famnick)
|
||||||
|
|
||||||
def pack_location(self, loc, with_parish):
|
def pack_location(self, loc, with_parish):
|
||||||
if with_parish:
|
if with_parish:
|
||||||
return ((loc.street, loc.city, loc.county, loc.state, loc.country,
|
return ((loc.street, loc.locality, loc.city, loc.county, loc.state, loc.country,
|
||||||
loc.postal, loc.phone), loc.parish)
|
loc.postal, loc.phone), loc.parish)
|
||||||
else:
|
else:
|
||||||
return (loc.street, loc.city, loc.county, loc.state, loc.country,
|
return (loc.street, loc.locality, loc.city, loc.county, loc.state, loc.country,
|
||||||
loc.postal, loc.phone)
|
loc.postal, loc.phone)
|
||||||
|
|
||||||
def pack_url(self, url):
|
def pack_url(self, url):
|
||||||
@ -966,9 +964,9 @@ class DjangoInterface(object):
|
|||||||
def add_name(self, person, data, preferred):
|
def add_name(self, person, data, preferred):
|
||||||
if data:
|
if data:
|
||||||
(private, source_list, note_list, date,
|
(private, source_list, note_list, date,
|
||||||
first_name, surname, suffix, title,
|
first_name, surname_list, suffix, title,
|
||||||
name_type, prefix, patronymic,
|
name_type, group_as, sort_as,
|
||||||
group_as, sort_as, display_as, call) = data
|
display_as, call, nick, famnick) = data
|
||||||
|
|
||||||
count = person.name_set.count()
|
count = person.name_set.count()
|
||||||
name = models.Name()
|
name = models.Name()
|
||||||
@ -976,16 +974,16 @@ class DjangoInterface(object):
|
|||||||
name.preferred = preferred
|
name.preferred = preferred
|
||||||
name.private = private
|
name.private = private
|
||||||
name.first_name = first_name
|
name.first_name = first_name
|
||||||
name.surname = surname
|
#name.surname_list = surname_list FIXME
|
||||||
name.suffix = suffix
|
name.suffix = suffix
|
||||||
name.title = title
|
name.title = title
|
||||||
name.name_type = models.get_type(models.NameType, name_type)
|
name.name_type = models.get_type(models.NameType, name_type)
|
||||||
name.prefix = prefix
|
|
||||||
name.patronymic = patronymic
|
|
||||||
name.group_as = group_as
|
name.group_as = group_as
|
||||||
name.sort_as = models.get_type(models.NameFormatType, sort_as)
|
name.sort_as = models.get_type(models.NameFormatType, sort_as)
|
||||||
name.display_as = models.get_type(models.NameFormatType, display_as)
|
name.display_as = models.get_type(models.NameFormatType, display_as)
|
||||||
name.call = call
|
name.call = call
|
||||||
|
name.nick = nick
|
||||||
|
name.famnick = famnick
|
||||||
# we know person exists
|
# we know person exists
|
||||||
# needs to have an ID for key
|
# needs to have an ID for key
|
||||||
name.person = person
|
name.person = person
|
||||||
@ -1017,7 +1015,7 @@ class DjangoInterface(object):
|
|||||||
psource_list, # 15
|
psource_list, # 15
|
||||||
pnote_list, # 16
|
pnote_list, # 16
|
||||||
change, # 17
|
change, # 17
|
||||||
marker, # 18
|
tag_list, # 18
|
||||||
private, # 19
|
private, # 19
|
||||||
person_ref_list, # 20
|
person_ref_list, # 20
|
||||||
) = data
|
) = data
|
||||||
@ -1026,8 +1024,7 @@ class DjangoInterface(object):
|
|||||||
gramps_id=gid,
|
gramps_id=gid,
|
||||||
last_changed=todate(change),
|
last_changed=todate(change),
|
||||||
private=private,
|
private=private,
|
||||||
marker_type = models.get_type(models.MarkerType, marker),
|
gender_type=models.get_type(models.GenderType, gender))
|
||||||
gender_type = models.get_type(models.GenderType, gender))
|
|
||||||
person.save()
|
person.save()
|
||||||
|
|
||||||
def add_person_detail(self, data):
|
def add_person_detail(self, data):
|
||||||
@ -1050,7 +1047,7 @@ class DjangoInterface(object):
|
|||||||
psource_list, # 15
|
psource_list, # 15
|
||||||
pnote_list, # 16
|
pnote_list, # 16
|
||||||
change, # 17
|
change, # 17
|
||||||
marker, # 18
|
tag_list, # 18
|
||||||
private, # 19
|
private, # 19
|
||||||
person_ref_list, # 20
|
person_ref_list, # 20
|
||||||
) = data
|
) = data
|
||||||
@ -1102,7 +1099,7 @@ class DjangoInterface(object):
|
|||||||
def add_note(self, data):
|
def add_note(self, data):
|
||||||
# Unpack from the BSDDB:
|
# Unpack from the BSDDB:
|
||||||
(handle, gid, styled_text, format, note_type,
|
(handle, gid, styled_text, format, note_type,
|
||||||
change, marker, private) = data
|
change, tag_list, private) = data
|
||||||
text, markup_list = styled_text
|
text, markup_list = styled_text
|
||||||
n = models.Note(handle=handle,
|
n = models.Note(handle=handle,
|
||||||
gramps_id=gid,
|
gramps_id=gid,
|
||||||
@ -1110,8 +1107,7 @@ class DjangoInterface(object):
|
|||||||
private=private,
|
private=private,
|
||||||
preformatted=format,
|
preformatted=format,
|
||||||
text=text,
|
text=text,
|
||||||
marker_type = models.get_type(models.MarkerType, marker),
|
note_type=models.get_type(models.NoteType, note_type))
|
||||||
note_type = models.get_type(models.NoteType, note_type))
|
|
||||||
n.save()
|
n.save()
|
||||||
count = 1
|
count = 1
|
||||||
for markup in markup_list:
|
for markup in markup_list:
|
||||||
@ -1129,12 +1125,11 @@ class DjangoInterface(object):
|
|||||||
(handle, gid, father_handle, mother_handle,
|
(handle, gid, father_handle, mother_handle,
|
||||||
child_ref_list, the_type, event_ref_list, media_list,
|
child_ref_list, the_type, event_ref_list, media_list,
|
||||||
attribute_list, lds_seal_list, source_list, note_list,
|
attribute_list, lds_seal_list, source_list, note_list,
|
||||||
change, marker, private) = data
|
change, tag_list, private) = data
|
||||||
|
|
||||||
family = models.Family(handle=handle, gramps_id=gid,
|
family = models.Family(handle=handle, gramps_id=gid,
|
||||||
family_rel_type = models.get_type(models.FamilyRelType, the_type),
|
family_rel_type = models.get_type(models.FamilyRelType, the_type),
|
||||||
last_changed=todate(change),
|
last_changed=todate(change),
|
||||||
marker_type = models.get_type(models.MarkerType, marker),
|
|
||||||
private=private)
|
private=private)
|
||||||
family.save()
|
family.save()
|
||||||
|
|
||||||
@ -1143,7 +1138,7 @@ class DjangoInterface(object):
|
|||||||
(handle, gid, father_handle, mother_handle,
|
(handle, gid, father_handle, mother_handle,
|
||||||
child_ref_list, the_type, event_ref_list, media_list,
|
child_ref_list, the_type, event_ref_list, media_list,
|
||||||
attribute_list, lds_seal_list, source_list, note_list,
|
attribute_list, lds_seal_list, source_list, note_list,
|
||||||
change, marker, private) = data
|
change, tag_list, private) = data
|
||||||
|
|
||||||
try:
|
try:
|
||||||
family = models.Family.objects.get(handle=handle)
|
family = models.Family.objects.get(handle=handle)
|
||||||
@ -1183,11 +1178,10 @@ class DjangoInterface(object):
|
|||||||
abbrev,
|
abbrev,
|
||||||
change, datamap,
|
change, datamap,
|
||||||
reporef_list,
|
reporef_list,
|
||||||
marker, private) = data
|
private) = data
|
||||||
source = models.Source(handle=handle, gramps_id=gid, title=title,
|
source = models.Source(handle=handle, gramps_id=gid, title=title,
|
||||||
author=author, pubinfo=pubinfo, abbrev=abbrev,
|
author=author, pubinfo=pubinfo, abbrev=abbrev,
|
||||||
last_changed=todate(change), private=private)
|
last_changed=todate(change), private=private)
|
||||||
source.marker_type = models.get_type(models.MarkerType, marker)
|
|
||||||
source.save()
|
source.save()
|
||||||
|
|
||||||
def add_source_detail(self, data):
|
def add_source_detail(self, data):
|
||||||
@ -1198,7 +1192,7 @@ class DjangoInterface(object):
|
|||||||
abbrev,
|
abbrev,
|
||||||
change, datamap,
|
change, datamap,
|
||||||
reporef_list,
|
reporef_list,
|
||||||
marker, private) = data
|
private) = data
|
||||||
try:
|
try:
|
||||||
source = models.Source.objects.get(handle=handle)
|
source = models.Source.objects.get(handle=handle)
|
||||||
except:
|
except:
|
||||||
@ -1212,11 +1206,10 @@ class DjangoInterface(object):
|
|||||||
|
|
||||||
def add_repository(self, data):
|
def add_repository(self, data):
|
||||||
(handle, gid, the_type, name, note_list,
|
(handle, gid, the_type, name, note_list,
|
||||||
address_list, url_list, change, marker, private) = data
|
address_list, url_list, change, private) = data
|
||||||
|
|
||||||
repository = models.Repository(handle=handle,
|
repository = models.Repository(handle=handle,
|
||||||
gramps_id=gid,
|
gramps_id=gid,
|
||||||
marker_type=models.get_type(models.MarkerType, marker),
|
|
||||||
last_changed=todate(change),
|
last_changed=todate(change),
|
||||||
private=private,
|
private=private,
|
||||||
repository_type=models.get_type(models.RepositoryType, the_type),
|
repository_type=models.get_type(models.RepositoryType, the_type),
|
||||||
@ -1225,7 +1218,7 @@ class DjangoInterface(object):
|
|||||||
|
|
||||||
def add_repository_detail(self, data):
|
def add_repository_detail(self, data):
|
||||||
(handle, gid, the_type, name, note_list,
|
(handle, gid, the_type, name, note_list,
|
||||||
address_list, url_list, change, marker, private) = data
|
address_list, url_list, change, private) = data
|
||||||
try:
|
try:
|
||||||
repository = models.Repository.objects.get(handle=handle)
|
repository = models.Repository.objects.get(handle=handle)
|
||||||
except:
|
except:
|
||||||
@ -1237,18 +1230,23 @@ class DjangoInterface(object):
|
|||||||
self.add_address_list("repository", repository, address_list)
|
self.add_address_list("repository", repository, address_list)
|
||||||
|
|
||||||
def add_location(self, field, obj, location_data, order):
|
def add_location(self, field, obj, location_data, order):
|
||||||
|
# location now has 8 items
|
||||||
|
# street, locality, city, county, state,
|
||||||
|
# country, postal, phone, parish
|
||||||
|
|
||||||
if location_data == None: return
|
if location_data == None: return
|
||||||
if len(location_data) == 7:
|
if len(location_data) == 8:
|
||||||
(street, city, county, state, country, postal, phone) = location_data
|
(street, locality, city, county, state, country, postal, phone) = location_data
|
||||||
parish = None
|
parish = None
|
||||||
elif len(location_data) == 2:
|
elif len(location_data) == 2:
|
||||||
((street, city, county, state, country, postal, phone), parish) = location_data
|
((street, locality, city, county, state, country, postal, phone), parish) = location_data
|
||||||
else:
|
else:
|
||||||
print >> sys.stderr, ("ERROR: unknown location: '%s'" %
|
print >> sys.stderr, ("ERROR: unknown location: '%s'" %
|
||||||
location_data)
|
location_data)
|
||||||
(street, city, county, state, country, postal, phone, parish) = \
|
(street, locality, city, county, state, country, postal, phone, parish) = \
|
||||||
("", "", "", "", "", "", "", "")
|
("", "", "", "", "", "", "", "", "")
|
||||||
location = models.Location(street = street,
|
location = models.Location(street = street,
|
||||||
|
locality = locality,
|
||||||
city = city,
|
city = city,
|
||||||
county = county,
|
county = county,
|
||||||
state = state,
|
state = state,
|
||||||
@ -1275,10 +1273,9 @@ class DjangoInterface(object):
|
|||||||
media_list,
|
media_list,
|
||||||
source_list,
|
source_list,
|
||||||
note_list,
|
note_list,
|
||||||
change, marker, private) = data
|
change, private) = data
|
||||||
place = models.Place(handle=handle, gramps_id=gid, title=title,
|
place = models.Place(handle=handle, gramps_id=gid, title=title,
|
||||||
long=long, lat=lat, last_changed=todate(change),
|
long=long, lat=lat, last_changed=todate(change),
|
||||||
marker_type=models.get_type(models.MarkerType, marker),
|
|
||||||
private=private)
|
private=private)
|
||||||
place.save()
|
place.save()
|
||||||
|
|
||||||
@ -1289,7 +1286,7 @@ class DjangoInterface(object):
|
|||||||
media_list,
|
media_list,
|
||||||
source_list,
|
source_list,
|
||||||
note_list,
|
note_list,
|
||||||
change, marker, private) = data
|
change, private) = data
|
||||||
try:
|
try:
|
||||||
place = models.Place.objects.get(handle=handle)
|
place = models.Place.objects.get(handle=handle)
|
||||||
except:
|
except:
|
||||||
@ -1313,12 +1310,11 @@ class DjangoInterface(object):
|
|||||||
note_list,
|
note_list,
|
||||||
change,
|
change,
|
||||||
date,
|
date,
|
||||||
marker,
|
tag_list,
|
||||||
private) = data
|
private) = data
|
||||||
media = models.Media(handle=handle, gramps_id=gid,
|
media = models.Media(handle=handle, gramps_id=gid,
|
||||||
path=path, mime=mime,
|
path=path, mime=mime,
|
||||||
desc=desc, last_changed=todate(change),
|
desc=desc, last_changed=todate(change),
|
||||||
marker_type=models.get_type(models.MarkerType, marker),
|
|
||||||
private=private)
|
private=private)
|
||||||
self.add_date(media, date)
|
self.add_date(media, date)
|
||||||
media.save()
|
media.save()
|
||||||
@ -1330,7 +1326,7 @@ class DjangoInterface(object):
|
|||||||
note_list,
|
note_list,
|
||||||
change,
|
change,
|
||||||
date,
|
date,
|
||||||
marker,
|
tag_list,
|
||||||
private) = data
|
private) = data
|
||||||
try:
|
try:
|
||||||
media = models.Media.objects.get(handle=handle)
|
media = models.Media.objects.get(handle=handle)
|
||||||
@ -1345,12 +1341,11 @@ class DjangoInterface(object):
|
|||||||
def add_event(self, data):
|
def add_event(self, data):
|
||||||
(handle, gid, the_type, date, description, place_handle,
|
(handle, gid, the_type, date, description, place_handle,
|
||||||
source_list, note_list, media_list, attribute_list,
|
source_list, note_list, media_list, attribute_list,
|
||||||
change, marker, private) = data
|
change, private) = data
|
||||||
event = models.Event(handle=handle,
|
event = models.Event(handle=handle,
|
||||||
gramps_id=gid,
|
gramps_id=gid,
|
||||||
event_type=models.get_type(models.EventType, the_type),
|
event_type=models.get_type(models.EventType, the_type),
|
||||||
private=private,
|
private=private,
|
||||||
marker_type=models.get_type(models.MarkerType, marker),
|
|
||||||
description=description,
|
description=description,
|
||||||
last_changed=todate(change))
|
last_changed=todate(change))
|
||||||
self.add_date(event, date)
|
self.add_date(event, date)
|
||||||
@ -1359,7 +1354,7 @@ class DjangoInterface(object):
|
|||||||
def add_event_detail(self, data):
|
def add_event_detail(self, data):
|
||||||
(handle, gid, the_type, date, description, place_handle,
|
(handle, gid, the_type, date, description, place_handle,
|
||||||
source_list, note_list, media_list, attribute_list,
|
source_list, note_list, media_list, attribute_list,
|
||||||
change, marker, private) = data
|
change, private) = data
|
||||||
try:
|
try:
|
||||||
event = models.Event.objects.get(handle=handle)
|
event = models.Event.objects.get(handle=handle)
|
||||||
except:
|
except:
|
||||||
|
@ -537,11 +537,15 @@ def render_name(name, user):
|
|||||||
if isinstance(name, models.Name):
|
if isinstance(name, models.Name):
|
||||||
if not user.is_authenticated():
|
if not user.is_authenticated():
|
||||||
name.sanitize()
|
name.sanitize()
|
||||||
return "%s, %s" % (name.surname, name.first_name)
|
# FIXME: get primary surname
|
||||||
|
#return "%s, %s" % (name.surname, name.first_name)
|
||||||
|
return "%s, %s" % ("FIXME", name.first_name)
|
||||||
elif isinstance(name, forms.NameForm):
|
elif isinstance(name, forms.NameForm):
|
||||||
if not user.is_authenticated():
|
if not user.is_authenticated():
|
||||||
name.model.sanitize()
|
name.model.sanitize()
|
||||||
return "%s, %s" % (name.model.surname, name.model.first_name)
|
# FIXME: get primary surname
|
||||||
|
#return "%s, %s" % (name.model.surname, name.model.first_name)
|
||||||
|
return "%s, %s" % ("FIXME", name.model.first_name)
|
||||||
elif isinstance(name, gen.lib.Person): # name is a gen.lib.Person
|
elif isinstance(name, gen.lib.Person): # name is a gen.lib.Person
|
||||||
person = name
|
person = name
|
||||||
try:
|
try:
|
||||||
@ -552,7 +556,8 @@ def render_name(name, user):
|
|||||||
return "[No preferred name]"
|
return "[No preferred name]"
|
||||||
if not user.is_authenticated():
|
if not user.is_authenticated():
|
||||||
name.sanitize()
|
name.sanitize()
|
||||||
return "%s, %s" % (name.surname, name.first_name)
|
#return "%s, %s" % (name.surname, name.first_name)
|
||||||
|
return "%s, %s" % ("FIXME", name.first_name)
|
||||||
elif isinstance(name, models.Person): # django person
|
elif isinstance(name, models.Person): # django person
|
||||||
person = name
|
person = name
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user