Family infrastructure in place

svn: r19642
This commit is contained in:
Doug Blank 2012-05-25 12:38:09 +00:00
parent 9ca1bd92fb
commit 961a35b529
5 changed files with 37 additions and 24 deletions

View File

@ -14,7 +14,7 @@
{% include "detail_breadcrumb.html" %}
<h2>{{familyform.father|render_name:user}} and {{familyform.mother|render_name:user}}</h2>
<h2><a href="/person/{{family.father.handle}}">{{family.father|render_name:user}}</a> and <a href="/person/{{family.mother.handle}}">{{family.mother|render_name:user}}</a></h2>
<div id="summaryarea">
<table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %}
@ -35,9 +35,9 @@
</tr>
<tr>
<td class="ColumnAttribute">Name:</td>
<td class="ColumnValue" id="data"><a href="/person/{{familyform.father.handle}}">{% render familyform.father user action %}</a></td>
<td class="ColumnValue" id="data">{% render familyform.father user action %}</td>
<td class="ColumnAttribute">Name:</td>
<td class="ColumnValue" id="data"><a href="/person/{{familyform.mother.handle}}">{% render familyform.mother user action %}</a></td>
<td class="ColumnValue" id="data">{% render familyform.mother user action %}</td>
</tr>
{% if user.is_authenticated or not familyform.father.probably_alive %}
<tr>
@ -48,10 +48,10 @@
</tr>
{% else %}
<tr>
<td class="ColumnAttribute">{{familyform.father.death.label}}:</td>
<td class="ColumnValue" id="data">{% render familyform.father user action %}</td>
<td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">[Private]</td>
<td class="ColumnAttribute">Death:</td>
<td class="ColumnValue" id="data">{{familyform.father.death|render_date:user}}</td>
<td class="ColumnAttribute">Death:</td>
<td class="ColumnValue" id="data">{{familyform.mother.death|render_date:user}}</td>
</tr>
{% endif %}
<tr>
@ -68,16 +68,16 @@
<th colspan="4">Relationship information</th>
</tr>
<tr>
<td class="ColumnAttribute">ID:</td>
<td class="ColumnValue" id="data">{{familyform.gramps_id}}</td>
<td class="ColumnAttribute">Type:</td>
<td class="ColumnValue" id="data">RELTYPE</td>
<td class="ColumnAttribute">{{familyform.gramps_id.label}}:</td>
<td class="ColumnValue" id="data">{% render familyform.gramps_id user action %}</td>
<td class="ColumnAttribute">{{familyform.family_rel_type.label}}:</td>
<td class="ColumnValue" id="data">{% render familyform.family_rel_type user action %}</td>
</tr>
<tr>
<td class="ColumnAttribute">Marker:</td>
<td class="ColumnValue" id="data">{{familyform.marker_type}}</td>
<td class="ColumnAttribute">Private:</td>
<td class="ColumnValue" id="data">{{familyform.private}}</td>
<td class="ColumnAttribute">{{familyform.tags.label}}:</td>
<td class="ColumnValue" id="data">{% render familyform.tags user action %}</td>
<td class="ColumnAttribute">{{familyform.private.label}}:</td>
<td class="ColumnValue" id="data">{% render familyform.private user action %}</td>
</tr>
</tbody>
</table>

View File

@ -394,6 +394,9 @@ class Tag(models.Model):
color = models.CharField(max_length=13) # "#000000000000" # Black
priority = models.IntegerField('priority', blank=False)
def __unicode__(self):
return str(self.name)
# Just the following have tag lists:
# ---------------------------------
#src/gen/lib/family.py
@ -877,6 +880,7 @@ TABLES = [
("primary", Place),
("primary", Media),
("primary", Note),
("primary", Tag),
("abstract", SecondaryObject),
("secondary", Attribute),
("secondary", SourceDatamap),

View File

@ -26,6 +26,7 @@ from webapp.utils import _, boolean
from webapp.grampsdb.models import Family
from webapp.grampsdb.forms import *
from webapp.libdjango import DjangoInterface
from Utils import create_id
## Django Modules
from django.shortcuts import get_object_or_404, render_to_response, redirect
@ -45,10 +46,16 @@ def process_family(request, context, handle, action): # view, edit, save
action = "add"
if request.POST.has_key("action"):
action = request.POST.get("action")
family = Family(father=Person.objects.all()[0],
family_rel_type=FamilyRelType.objects.get(
val=FamilyRelType._DEFAULT[0]))
familyform = FamilyForm(instance=family)
familyform.model = family
context["familyform"] = FamilyForm()
context["object"] = Family()
context["family"] = Family()
context["familyform"] = familyform
context["object"] = family
context["family"] = family
context["action"] = action
view_template = "view_family_detail.html"

View File

@ -59,7 +59,6 @@ from webapp.grampsdb.view import *
from webapp.dbdjango import DbDjango
import cli.user
import gen.proxy
from Utils import create_id
import const
# Menu: (<Nice name>, /<path>/, <Model> | None, Need authentication )

View File

@ -607,10 +607,9 @@ def display_date(obj):
return ""
def render(formfield, user, action, test=False, truetext="", id=None):
#import pdb; pdb.set_trace()
if not user.is_authenticated():
action = "view"
if action == "view":
if action == "view": # show as text
if (not user.is_authenticated() and not test) or user.is_authenticated():
fieldname = formfield.name # 'surname'
try:
@ -620,10 +619,12 @@ def render(formfield, user, action, test=False, truetext="", id=None):
try:
retval = str(formfield.form.data[fieldname]) # formfield._data()
except:
retval = "[ERROR: %s]" % fieldname
#import pdb; pdb.set_trace()
#retval = "[ERROR: %s]" % fieldname
retval = "[None]"
else:
retval = truetext
else:
else: # show as widget
if id != None:
retval = formfield.as_widget(attrs={"id": id})
else:
@ -635,7 +636,9 @@ def render_name(name, user):
Given a Django or Gramps object, render the name and return. This
function uses authentication, privacy and probably_alive settings.
"""
if isinstance(name, models.Name):
if name is None:
return "[None]"
elif isinstance(name, models.Name):
if not user.is_authenticated():
name.sanitize()
try: