Family infrastructure in place
svn: r19642
This commit is contained in:
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
{% include "detail_breadcrumb.html" %}
|
{% 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">
|
<div id="summaryarea">
|
||||||
<table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %}
|
<table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %}
|
||||||
@ -35,9 +35,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ColumnAttribute">Name:</td>
|
<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="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>
|
</tr>
|
||||||
{% if user.is_authenticated or not familyform.father.probably_alive %}
|
{% if user.is_authenticated or not familyform.father.probably_alive %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -48,10 +48,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ColumnAttribute">{{familyform.father.death.label}}:</td>
|
<td class="ColumnAttribute">Death:</td>
|
||||||
<td class="ColumnValue" id="data">{% render familyform.father user action %}</td>
|
<td class="ColumnValue" id="data">{{familyform.father.death|render_date:user}}</td>
|
||||||
<td class="ColumnAttribute">Birth:</td>
|
<td class="ColumnAttribute">Death:</td>
|
||||||
<td class="ColumnValue" id="data">[Private]</td>
|
<td class="ColumnValue" id="data">{{familyform.mother.death|render_date:user}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -68,16 +68,16 @@
|
|||||||
<th colspan="4">Relationship information</th>
|
<th colspan="4">Relationship information</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ColumnAttribute">ID:</td>
|
<td class="ColumnAttribute">{{familyform.gramps_id.label}}:</td>
|
||||||
<td class="ColumnValue" id="data">{{familyform.gramps_id}}</td>
|
<td class="ColumnValue" id="data">{% render familyform.gramps_id user action %}</td>
|
||||||
<td class="ColumnAttribute">Type:</td>
|
<td class="ColumnAttribute">{{familyform.family_rel_type.label}}:</td>
|
||||||
<td class="ColumnValue" id="data">RELTYPE</td>
|
<td class="ColumnValue" id="data">{% render familyform.family_rel_type user action %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ColumnAttribute">Marker:</td>
|
<td class="ColumnAttribute">{{familyform.tags.label}}:</td>
|
||||||
<td class="ColumnValue" id="data">{{familyform.marker_type}}</td>
|
<td class="ColumnValue" id="data">{% render familyform.tags user action %}</td>
|
||||||
<td class="ColumnAttribute">Private:</td>
|
<td class="ColumnAttribute">{{familyform.private.label}}:</td>
|
||||||
<td class="ColumnValue" id="data">{{familyform.private}}</td>
|
<td class="ColumnValue" id="data">{% render familyform.private user action %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -394,6 +394,9 @@ class Tag(models.Model):
|
|||||||
color = models.CharField(max_length=13) # "#000000000000" # Black
|
color = models.CharField(max_length=13) # "#000000000000" # Black
|
||||||
priority = models.IntegerField('priority', blank=False)
|
priority = models.IntegerField('priority', blank=False)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return str(self.name)
|
||||||
|
|
||||||
# Just the following have tag lists:
|
# Just the following have tag lists:
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
#src/gen/lib/family.py
|
#src/gen/lib/family.py
|
||||||
@ -877,6 +880,7 @@ TABLES = [
|
|||||||
("primary", Place),
|
("primary", Place),
|
||||||
("primary", Media),
|
("primary", Media),
|
||||||
("primary", Note),
|
("primary", Note),
|
||||||
|
("primary", Tag),
|
||||||
("abstract", SecondaryObject),
|
("abstract", SecondaryObject),
|
||||||
("secondary", Attribute),
|
("secondary", Attribute),
|
||||||
("secondary", SourceDatamap),
|
("secondary", SourceDatamap),
|
||||||
|
@ -26,6 +26,7 @@ from webapp.utils import _, boolean
|
|||||||
from webapp.grampsdb.models import Family
|
from webapp.grampsdb.models import Family
|
||||||
from webapp.grampsdb.forms import *
|
from webapp.grampsdb.forms import *
|
||||||
from webapp.libdjango import DjangoInterface
|
from webapp.libdjango import DjangoInterface
|
||||||
|
from Utils import create_id
|
||||||
|
|
||||||
## Django Modules
|
## Django Modules
|
||||||
from django.shortcuts import get_object_or_404, render_to_response, redirect
|
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"
|
action = "add"
|
||||||
if request.POST.has_key("action"):
|
if request.POST.has_key("action"):
|
||||||
action = request.POST.get("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["familyform"] = familyform
|
||||||
context["object"] = Family()
|
context["object"] = family
|
||||||
context["family"] = Family()
|
context["family"] = family
|
||||||
context["action"] = action
|
context["action"] = action
|
||||||
view_template = "view_family_detail.html"
|
view_template = "view_family_detail.html"
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ from webapp.grampsdb.view import *
|
|||||||
from webapp.dbdjango import DbDjango
|
from webapp.dbdjango import DbDjango
|
||||||
import cli.user
|
import cli.user
|
||||||
import gen.proxy
|
import gen.proxy
|
||||||
from Utils import create_id
|
|
||||||
import const
|
import const
|
||||||
|
|
||||||
# Menu: (<Nice name>, /<path>/, <Model> | None, Need authentication )
|
# Menu: (<Nice name>, /<path>/, <Model> | None, Need authentication )
|
||||||
|
@ -607,10 +607,9 @@ def display_date(obj):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
def render(formfield, user, action, test=False, truetext="", id=None):
|
def render(formfield, user, action, test=False, truetext="", id=None):
|
||||||
#import pdb; pdb.set_trace()
|
|
||||||
if not user.is_authenticated():
|
if not user.is_authenticated():
|
||||||
action = "view"
|
action = "view"
|
||||||
if action == "view":
|
if action == "view": # show as text
|
||||||
if (not user.is_authenticated() and not test) or user.is_authenticated():
|
if (not user.is_authenticated() and not test) or user.is_authenticated():
|
||||||
fieldname = formfield.name # 'surname'
|
fieldname = formfield.name # 'surname'
|
||||||
try:
|
try:
|
||||||
@ -620,10 +619,12 @@ def render(formfield, user, action, test=False, truetext="", id=None):
|
|||||||
try:
|
try:
|
||||||
retval = str(formfield.form.data[fieldname]) # formfield._data()
|
retval = str(formfield.form.data[fieldname]) # formfield._data()
|
||||||
except:
|
except:
|
||||||
retval = "[ERROR: %s]" % fieldname
|
#import pdb; pdb.set_trace()
|
||||||
|
#retval = "[ERROR: %s]" % fieldname
|
||||||
|
retval = "[None]"
|
||||||
else:
|
else:
|
||||||
retval = truetext
|
retval = truetext
|
||||||
else:
|
else: # show as widget
|
||||||
if id != None:
|
if id != None:
|
||||||
retval = formfield.as_widget(attrs={"id": id})
|
retval = formfield.as_widget(attrs={"id": id})
|
||||||
else:
|
else:
|
||||||
@ -635,7 +636,9 @@ def render_name(name, user):
|
|||||||
Given a Django or Gramps object, render the name and return. This
|
Given a Django or Gramps object, render the name and return. This
|
||||||
function uses authentication, privacy and probably_alive settings.
|
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():
|
if not user.is_authenticated():
|
||||||
name.sanitize()
|
name.sanitize()
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user