diff --git a/src/data/templates/view_family_detail.html b/src/data/templates/view_family_detail.html index d5fc2a736..1de610de7 100644 --- a/src/data/templates/view_family_detail.html +++ b/src/data/templates/view_family_detail.html @@ -14,41 +14,51 @@ {% include "detail_breadcrumb.html" %} -

{{family.father|make_name:user}} and {{family.mother|make_name:user}}

+

{{familyform.father|render_name:user}} and {{familyform.mother|render_name:user}}

{% comment %} 4 cols {% endcomment %} + {% for error in personform.errors %} +

Error in person: {{error}}

+ {% endfor %} + {% for error in nameform.errors %} +

Error in name: {{error}}

+ {% endfor %} + {% for error in surnameform.errors %} +

Error in surname: {{error}}

+ {% endfor %} +{% csrf_token %} - + - + -{% if user.is_authenticated or not family.father.probably_alive %} +{% if user.is_authenticated or not familyform.father.probably_alive %} - + - + {% else %} - - + + {% endif %} - + - +
Father Mother
Name:{{family.father|render_name:user}} [{{family.father.gramps_id}}]{% render familyform.father user action %} Name:{{family.mother|render_name:user}} [{{family.mother.gramps_id}}]{% render familyform.mother user action %}
Birth:{{family.father.birth|render_date:user}}{{familyform.father.birth|render_date:user}} Birth:{{family.mother.birth|render_date:user}}{{familyform.mother.birth|render_date:user}}
Birth:[Private]{{familyform.father.death.label}}:{% render familyform.father user action %} Birth: [Private]
Death:{{family.father.death|render_date:user}}{{familyform.father.death|render_date:user}} Death:{{family.mother.death|render_date:user}}{{familyform.mother.death|render_date:user}}
@@ -59,15 +69,15 @@ ID: - {{family.gramps_id}} + {{familyform.gramps_id}} Type: RELTYPE Marker: - {{family.marker_type}} + {{familyform.marker_type}} Private: - {{family.private}} + {{familyform.private}} @@ -109,5 +119,26 @@ {% lds_table family user action "/family/%s/children" family.handle %}
+ +{% if user.is_superuser %} + {% if action == "edit" %} + {% make_button "Back to Family" "/family/%s" family.handle %} + + + {% else %} + {% ifequal action "add" %} + {% make_button "Cancel" "/family/" %} + + + {% 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 %} + {% endblock %} diff --git a/src/webapp/empty.sql b/src/webapp/empty.sql index 0569ef4a5..e9dcb98fb 100644 --- a/src/webapp/empty.sql +++ b/src/webapp/empty.sql @@ -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, diff --git a/src/webapp/grampsdb/forms.py b/src/webapp/grampsdb/forms.py index b21a43552..3b9515380 100644 --- a/src/webapp/grampsdb/forms.py +++ b/src/webapp/grampsdb/forms.py @@ -122,3 +122,7 @@ class SurnameForm(forms.ModelForm): this.style.fontStyle = 'italic'; } """})) +class FamilyForm(forms.ModelForm): + class Meta: + model = Family + diff --git a/src/webapp/grampsdb/models.py b/src/webapp/grampsdb/models.py index 6406c7a90..1a5bc4398 100644 --- a/src/webapp/grampsdb/models.py +++ b/src/webapp/grampsdb/models.py @@ -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() diff --git a/src/webapp/grampsdb/view/family.py b/src/webapp/grampsdb/view/family.py index ca959cf6f..8deb605ef 100644 --- a/src/webapp/grampsdb/view/family.py +++ b/src/webapp/grampsdb/view/family.py @@ -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) diff --git a/src/webapp/utils.py b/src/webapp/utils.py index 4b356d701..a430df2a2 100644 --- a/src/webapp/utils.py +++ b/src/webapp/utils.py @@ -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