Second step in bringing gramps-connect back into sync with gramps 3.3

svn: r16671
This commit is contained in:
Doug Blank 2011-02-19 02:36:20 +00:00
parent 90aaf57238
commit 505d389087
6 changed files with 58 additions and 31 deletions

View File

@ -63,7 +63,7 @@
<p id="createdate">
Gramps Connect, tools for genealogy collaborations
</p>
<p id="copyright">&copy; 2009 <a href="http://www.gramps-project.org/">www.gramps-project.org</a>
<p id="copyright">&copy; 2009-2011 <a href="http://www.gramps-project.org/">www.gramps-project.org</a>
</p>
{% endblock %}
</div>

View File

@ -29,10 +29,8 @@
{% endif %}
<tr>
<td class="ColumnAttribute">{{nameform.surname.label}}</td>
<td class="ColumnValue" id="data">{% render nameform.surname user action %}</td>
<td class="ColumnAttribute">{{nameform.prefix.label}}</td>
<td class="ColumnValue" id="data">{% render nameform.prefix user action %}</td>
<td class="ColumnAttribute"></td>
<td class="ColumnValue" id="data"></td>
<td rowspan="7" colspan="2" style="border:solid 2px #7D5925;">Image:</td>
</tr>
<tr>
@ -49,8 +47,6 @@
<tr>
<td class="ColumnAttribute">{{nameform.name_type.label}}</td>
<td class="ColumnValue" id="data">{% render nameform.name_type user action %}</td>
<td class="ColumnAttribute">{{nameform.patronymic.label}}</td>
<td class="ColumnValue" id="data">{% render nameform.patronymic user action %}</td>
</tr>
<tr>
<td class="ColumnAttribute" colspan="2"></td>
@ -64,8 +60,6 @@
<td class="ColumnValue" id="data">{% render personform.gramps_id user action %}</td>
</tr>
<tr>
<td class="ColumnAttribute">{{personform.marker_type.label}}</td>
<td class="ColumnValue" id="data">{% render personform.marker_type user action %}</td>
<td class="ColumnAttribute">{{personform.private.label}}</td>
<td class="ColumnValue" id="data">{% render personform.private user action %}</td>
</tr>

View File

@ -447,6 +447,12 @@ class Person(PrimaryObject):
"""
return self.name_set.get(preferred=True)
def __unicode__(self):
return str(self.get_primary_name())
def make_tag_list(self):
return []
class Family(PrimaryObject):
father = models.ForeignKey('Person', related_name="father_ref",
null=True, blank=True)
@ -455,6 +461,9 @@ class Family(PrimaryObject):
family_rel_type = models.ForeignKey('FamilyRelType')
tags = models.ManyToManyField('Tag', blank=True, null=True)
def make_tag_list(self):
return []
#lds_list = models.ManyToManyField('Lds', null=True, blank=True)
# Others keys here:
@ -513,6 +522,9 @@ class Media(DateObject, PrimaryObject):
object_id_field="object_id")
tags = models.ManyToManyField('Tag', blank=True, null=True)
def make_tag_list(self):
return []
class Note(PrimaryObject):
note_type = models.ForeignKey('NoteType')
text = models.TextField(blank=True)
@ -522,6 +534,9 @@ class Note(PrimaryObject):
object_id_field="object_id")
tags = models.ManyToManyField('Tag', blank=True, null=True)
def make_tag_list(self):
return []
#---------------------------------------------------------------------------
#
# Secondary Tables
@ -551,10 +566,12 @@ class Surname(models.Model):
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")
def __unicode__(self):
return "%s" % self.surname
class Name(DateObject, SecondaryObject):
name_type = models.ForeignKey('NameType',
related_name="name_code",
@ -563,9 +580,9 @@ class Name(DateObject, SecondaryObject):
first_name = models.TextField(blank=True)
suffix = models.TextField(blank=True)
title = models.TextField(blank=True)
prefix = models.TextField(blank=True)
patronymic = models.TextField(blank=True)
call = models.TextField(blank=True)
nick = models.TextField(blank=True)
famnick = models.TextField(blank=True)
group_as = models.TextField(blank=True)
sort_as = models.ForeignKey('NameFormatType',
related_name="sort_as",
@ -577,11 +594,12 @@ class Name(DateObject, SecondaryObject):
person = models.ForeignKey("Person")
_sanitized = False
def get_primary_surname(self):
return self.surname_set.get(primary=True).surname
def __unicode__(self):
return "%s%s%s, %s" % (self.prefix,
["", " "][bool(self.prefix)],
self.surname,
self.first_name)
return "%s, %s" % (self.get_primary_surname(),
self.first_name)
@staticmethod
def get_dummy():
name = Name()
@ -596,6 +614,9 @@ class Name(DateObject, SecondaryObject):
self.group_as = ""
self.title = ""
def make_surname_list(self):
return []
class Lds(DateObject, SecondaryObject):
"""
BAPTISM = 0
@ -801,6 +822,7 @@ TABLES = [
("secondary", Attribute),
("secondary", Datamap),
("secondary", Name),
("secondary", Surname),
("secondary", Lds),
("secondary", Markup),
("secondary", Address),

View File

@ -280,7 +280,7 @@ class DjangoInterface(object):
note.preformatted,
tuple(note.note_type),
changed,
tuple(note.tag_list),
tuple(note.make_tag_list()),
note.private)
def get_family(self, family):
@ -306,7 +306,7 @@ class DjangoInterface(object):
attribute_list, lds_seal_list,
source_list, note_list,
totime(family.last_changed),
tuple(family.tag_list),
tuple(family.make_tag_list()),
family.private)
def get_repository(self, repository):
@ -356,7 +356,7 @@ class DjangoInterface(object):
note_list,
totime(media.last_changed),
date,
tuple(media.tag_list),
tuple(media.make_tag_list()),
media.private)
def get_person(self, person):
@ -396,7 +396,7 @@ class DjangoInterface(object):
psource_list,
pnote_list,
totime(person.last_changed),
tuple(person.tag_list),
tuple(person.make_tag_list()),
person.private,
person_ref_list)
@ -555,7 +555,7 @@ class DjangoInterface(object):
note_list = self.get_note_list(name)
date = self.get_date(name)
return (name.private, source_list, note_list, date,
name.first_name, name.surname_list, name.suffix,
name.first_name, name.make_surname_list(), name.suffix,
name.title, tuple(name.name_type),
name.group_as, name.sort_as.val,
name.display_as.val, name.call, name.nick,
@ -597,6 +597,21 @@ class DjangoInterface(object):
for event_ref in event_ref_list:
self.add_event_ref(obj, event_ref)
def add_surname_list(self, name, surname_list):
print surname_list, name
for data in surname_list:
(surname_text, prefix, primary, origin_type,
connector) = data
surname = models.Surname()
surname.surname = surname_text
surname.prefix = prefix
surname.primary = primary
surname.name_origin_type = models.get_type(models.NameOriginType,
origin_type)
surname.connector = connector
surname.name = name
surname.save()
def add_note_list(self, obj, note_list):
for handle in note_list:
# Just the handle
@ -974,7 +989,6 @@ class DjangoInterface(object):
name.preferred = preferred
name.private = private
name.first_name = first_name
#name.surname_list = surname_list FIXME
name.suffix = suffix
name.title = title
name.name_type = models.get_type(models.NameType, name_type)
@ -989,6 +1003,7 @@ class DjangoInterface(object):
name.person = person
self.add_date(name, date)
name.save()
self.add_surname_list(name, surname_list)
self.add_note_list(name, note_list)
self.add_source_ref_list(name, source_list)
#person.save()

View File

@ -26,7 +26,7 @@
import const
import os
DEBUG = False
DEBUG = True
TEMPLATE_DEBUG = DEBUG
INTERNAL_IPS = ('127.0.0.1',)

View File

@ -537,15 +537,12 @@ def render_name(name, user):
if isinstance(name, models.Name):
if not user.is_authenticated():
name.sanitize()
# FIXME: get primary surname
#return "%s, %s" % (name.surname, name.first_name)
return "%s, %s" % ("FIXME", name.first_name)
return "%s, %s" % (name.get_primary_surname(), name.first_name)
elif isinstance(name, forms.NameForm):
if not user.is_authenticated():
name.model.sanitize()
# FIXME: get primary surname
#return "%s, %s" % (name.model.surname, name.model.first_name)
return "%s, %s" % ("FIXME", name.model.first_name)
return "%s, %s" % (name.model.get_primary_surname(),
name.model.first_name)
elif isinstance(name, gen.lib.Person): # name is a gen.lib.Person
person = name
try:
@ -556,8 +553,7 @@ def render_name(name, user):
return "[No preferred name]"
if not user.is_authenticated():
name.sanitize()
#return "%s, %s" % (name.surname, name.first_name)
return "%s, %s" % ("FIXME", name.first_name)
return "%s, %s" % (name.get_primary_surname(), name.first_name)
elif isinstance(name, models.Person): # django person
person = name
try: