Working on Family

svn: r19641
This commit is contained in:
Doug Blank 2012-05-25 01:45:16 +00:00
parent bb1bf9ac7a
commit 9ca1bd92fb
6 changed files with 75 additions and 20 deletions

View File

@ -14,41 +14,51 @@
{% include "detail_breadcrumb.html" %}
<h2>{{family.father|make_name:user}} and {{family.mother|make_name:user}}</h2>
<h2>{{familyform.father|render_name:user}} and {{familyform.mother|render_name:user}}</h2>
<div id="summaryarea">
<table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %}
<tbody>
{% for error in personform.errors %}
<p id="error">Error in person: {{error}}</p>
{% endfor %}
{% for error in nameform.errors %}
<p id="error">Error in name: {{error}}</p>
{% endfor %}
{% for error in surnameform.errors %}
<p id="error">Error in surname: {{error}}</p>
{% endfor %}
<form method="post">{% csrf_token %}
<tr>
<th colspan="2">Father</th>
<th colspan="2">Mother</th>
</tr>
<tr>
<td class="ColumnAttribute">Name:</td>
<td class="ColumnValue" id="data"><a href="/person/{{family.father.handle}}">{{family.father|render_name:user}} [{{family.father.gramps_id}}]</a></td>
<td class="ColumnValue" id="data"><a href="/person/{{familyform.father.handle}}">{% render familyform.father user action %}</a></td>
<td class="ColumnAttribute">Name:</td>
<td class="ColumnValue" id="data"><a href="/person/{{family.mother.handle}}">{{family.mother|render_name:user}} [{{family.mother.gramps_id}}]</a></td>
<td class="ColumnValue" id="data"><a href="/person/{{familyform.mother.handle}}">{% render familyform.mother user action %}</a></td>
</tr>
{% if user.is_authenticated or not family.father.probably_alive %}
{% if user.is_authenticated or not familyform.father.probably_alive %}
<tr>
<td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">{{family.father.birth|render_date:user}}</td>
<td class="ColumnValue" id="data">{{familyform.father.birth|render_date:user}}</td>
<td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">{{family.mother.birth|render_date:user}}</td>
<td class="ColumnValue" id="data">{{familyform.mother.birth|render_date:user}}</td>
</tr>
{% else %}
<tr>
<td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">[Private]</td>
<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>
</tr>
{% endif %}
<tr>
<td class="ColumnAttribute">Death:</td>
<td class="ColumnValue" id="data">{{family.father.death|render_date:user}}</td>
<td class="ColumnValue" id="data">{{familyform.father.death|render_date:user}}</td>
<td class="ColumnAttribute">Death:</td>
<td class="ColumnValue" id="data">{{family.mother.death|render_date:user}}</td>
<td class="ColumnValue" id="data">{{familyform.mother.death|render_date:user}}</td>
</tr>
</tbody>
</table>
@ -59,15 +69,15 @@
</tr>
<tr>
<td class="ColumnAttribute">ID:</td>
<td class="ColumnValue" id="data">{{family.gramps_id}}</td>
<td class="ColumnValue" id="data">{{familyform.gramps_id}}</td>
<td class="ColumnAttribute">Type:</td>
<td class="ColumnValue" id="data">RELTYPE</td>
</tr>
<tr>
<td class="ColumnAttribute">Marker:</td>
<td class="ColumnValue" id="data">{{family.marker_type}}</td>
<td class="ColumnValue" id="data">{{familyform.marker_type}}</td>
<td class="ColumnAttribute">Private:</td>
<td class="ColumnValue" id="data">{{family.private}}</td>
<td class="ColumnValue" id="data">{{familyform.private}}</td>
</tr>
</tbody>
</table>
@ -109,5 +119,26 @@
{% lds_table family user action "/family/%s/children" family.handle %}
</div>
</div>
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Family" "/family/%s" family.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
{% ifequal action "add" %}
{% make_button "Cancel" "/family/" %}
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Families" "/family" %}
{% make_button "Add Family" "/family/add" %}
{% make_button "Edit Family" "/family/%s/edit" family.handle %}
{% make_button "Delete Family" "/family/%s/delete" family.handle %}
{% endifequal %}
{% endif %}
{% else %}
{% endif %}
</form>
{% endblock %}

View File

@ -219,7 +219,8 @@ CREATE TABLE "auth_user" (
"last_login" datetime NOT NULL,
"date_joined" datetime NOT NULL
);
INSERT INTO "auth_user" VALUES(1,'admin','','','doug.blank@gmail.com','sha1$e702c$76d3a7dfc417b4e80faa6a032a54220d270eeda5',1,1,1,'2012-05-19 07:40:35.640321','2012-05-19 07:40:35.640321');
INSERT INTO "auth_user" VALUES(1,'admin','','','bugs@gramps-project.org','sha1$27271$3bf37b85204e28ce39a5ab19505306cf2925e997',1,1,1,'2012-05-24 18:13:26.243285','2012-05-24 18:11:18.576187');
INSERT INTO "auth_user" VALUES(2,'admin1','','','','sha1$a1880$d61d1cb0467158d6ee8c765af6c5d897b518aeca',0,1,0,'2012-05-24 18:13:52','2012-05-24 18:13:52');
CREATE TABLE "auth_message" (
"id" integer NOT NULL PRIMARY KEY,
"user_id" integer NOT NULL REFERENCES "auth_user" ("id"),
@ -296,6 +297,10 @@ CREATE TABLE "django_session" (
"session_data" text NOT NULL,
"expire_date" datetime NOT NULL
);
INSERT INTO "django_session" VALUES('8928553c90d43632f58fcff353176faa','MmU1MjliMDM2NzcyODdjNmJlOTgzMGFiYzc2MjFkMmViYWFiOTIzMjqAAn1xAShVEl9hdXRoX3Vz
ZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHED
VQ1fYXV0aF91c2VyX2lkcQRLAXUu
','2012-06-07 18:13:26.602244');
CREATE TABLE "django_site" (
"id" integer NOT NULL PRIMARY KEY,
"domain" varchar(100) NOT NULL,
@ -312,12 +317,15 @@ CREATE TABLE "django_admin_log" (
"action_flag" smallint unsigned NOT NULL,
"change_message" text NOT NULL
);
INSERT INTO "django_admin_log" VALUES(1,'2012-05-24 18:13:52.236486',1,3,'2','admin1',1,'');
INSERT INTO "django_admin_log" VALUES(2,'2012-05-24 18:14:06.532544',1,3,'2','admin1',2,'No fields changed.');
CREATE TABLE "grampsdb_profile" (
"id" integer NOT NULL PRIMARY KEY,
"user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id"),
"css_theme" varchar(40) NOT NULL
);
INSERT INTO "grampsdb_profile" VALUES(1,1,'Web_Mainz.css');
INSERT INTO "grampsdb_profile" VALUES(2,2,'Web_Mainz.css');
CREATE TABLE "grampsdb_nametype" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(40) NOT NULL,
@ -616,10 +624,11 @@ CREATE TABLE "grampsdb_config" (
);
INSERT INTO "grampsdb_config" VALUES(1,'sitename','site name of family tree','str','Gramps-Connect');
INSERT INTO "grampsdb_config" VALUES(2,'db_version','database scheme version','str','0.5.1');
INSERT INTO "grampsdb_config" VALUES(3,'db_created','database creation date/time','str','2012-05-19 07:39');
INSERT INTO "grampsdb_config" VALUES(3,'db_created','database creation date/time','str','2012-05-24 18:10');
CREATE TABLE "grampsdb_tag" (
"id" integer NOT NULL PRIMARY KEY,
"handle" varchar(19) NOT NULL UNIQUE,
"gramps_id" text,
"last_saved" datetime NOT NULL,
"last_changed" datetime,
"last_changed_by" text,
@ -832,7 +841,8 @@ CREATE TABLE "grampsdb_surname" (
"prefix" text NOT NULL,
"primary" bool NOT NULL,
"connector" text NOT NULL,
"name_id" integer NOT NULL
"name_id" integer NOT NULL,
"order" integer unsigned NOT NULL
);
CREATE TABLE "grampsdb_name" (
"id" integer NOT NULL PRIMARY KEY,

View File

@ -122,3 +122,7 @@ class SurnameForm(forms.ModelForm):
this.style.fontStyle = 'italic';
}
"""}))
class FamilyForm(forms.ModelForm):
class Meta:
model = Family

View File

@ -462,7 +462,7 @@ class Person(PrimaryObject):
return ""
def __unicode__(self):
return str(self.get_primary_name())
return "%s [%s]" % (self.get_primary_name(), self.gramps_id)
def make_tag_list(self):
return tuple()

View File

@ -40,9 +40,16 @@ def process_family(request, context, handle, action): # view, edit, save
"""
context["tview"] = _("Family")
context["tviews"] = _("Familes")
context["action"] = "view"
context["family"] = Family()
if handle == "add":
action = "add"
if request.POST.has_key("action"):
action = request.POST.get("action")
context["familyform"] = FamilyForm()
context["object"] = Family()
context["family"] = Family()
context["action"] = action
view_template = "view_family_detail.html"
return render_to_response(view_template, context)

View File

@ -568,7 +568,10 @@ def children_table(obj, user, action, url=None, *args):
count += 1
table.links(links)
retval += table.get_html()
retval += nbsp("") # to keep tabs same height
if user.is_superuser and url and action == "view":
retval += make_button(_("Add child"), (url + "/child/add") % args)
else:
retval += nbsp("") # to keep tabs same height
return retval
## FIXME: these dji function wrappers just use the functions