Working on editing person
svn: r18342
This commit is contained in:
parent
dcf5fe856f
commit
22d91dfd6c
@ -14,11 +14,9 @@
|
||||
|
||||
{{ "/browse|Browse,/person|People"|breadcrumb}}
|
||||
|
||||
<h3>{{nameform|render_name:user}} [{{person.gramps_id}}]</h3>
|
||||
<div id="summaryarea">
|
||||
<table class="infolist"> {% comment %} 5 cols {% endcomment %}
|
||||
<tbody>
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
{% ifequal action "edit" %}
|
||||
{% for error in personform.errors %}
|
||||
@ -32,38 +30,40 @@
|
||||
{% endif %}
|
||||
|
||||
<tr>
|
||||
<td class="ColumnAttribute"></td>
|
||||
<td class="ColumnValue" id="data"></td>
|
||||
<td rowspan="7" colspan="2" style="border:solid 2px #7D5925;">Image:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute" colspan="2"></td>
|
||||
<td class="ColumnAttribute">{{nameform.suffix.label}}</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.suffix user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{nameform.first_name.label}}</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.first_name user action nameform.model.person.probably_alive "[Living]" %}</td>
|
||||
<td class="ColumnAttribute">{{nameform.call.label}}</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.call user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{nameform.name_type.label}}</td>
|
||||
<td colspan="4">{{nameform|render_name:user}} [{{person.gramps_id}}]</td>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.name_type.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.name_type user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute" colspan="2"></td>
|
||||
<td class="ColumnAttribute">{{nameform.title.label}}</td>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.title.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.title user action %}</td>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.nick.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.nick user action %}</td>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.call.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.call user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{personform.gender_type.label}}</td>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.first_name.label}}:</td>
|
||||
<td class="ColumnValue" id="data" colspan="4">{% render nameform.first_name user action %}</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.suffix user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.surname.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.prefix user action %}</td>
|
||||
<td class="ColumnValue" id="data" colspan="2">{% render nameform.surname user action %}</td>
|
||||
<td class="ColumnAttribute" align="right">{{nameform.origin.label}}:</td>
|
||||
<td class="ColumnValue" id="data" colspan="2">{% render nameform.origin user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute" align="right">{{personform.gender_type.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render personform.gender_type user action %}</td>
|
||||
<td class="ColumnAttribute">{{personform.gramps_id.label}}</td>
|
||||
<td class="ColumnAttribute" align="right">{{personform.gramps_id.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render personform.gramps_id user action %}</td>
|
||||
<td class="ColumnAttribute" align="right">{{personform.tags.label}}:</td>
|
||||
<td class="ColumnValue" id="data" rowspan="2">{% render personform.tags user action %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{personform.private.label}}</td>
|
||||
<td class="ColumnAttribute" align="right">{{personform.private.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render personform.private user action %}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -12,11 +12,6 @@ class PersonForm(forms.ModelForm):
|
||||
model = Person
|
||||
exclude = ["death", "birth", "handle", "birth_ref_index", "death_ref_index"]
|
||||
|
||||
surname = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
prefix = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
|
||||
class NameForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Name
|
||||
@ -33,23 +28,41 @@ class NameForm(forms.ModelForm):
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
first_name = forms.CharField(label="Given",
|
||||
required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
widget=TextInput(attrs={'size':'60'}))
|
||||
title = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
widget=TextInput(attrs={'size':'15'}))
|
||||
prefix = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
initial='prefix',
|
||||
widget=TextInput(attrs={'size':'15',
|
||||
'style': 'font-style: italic; color: gray; ',
|
||||
'onFocus': """if (this.value == 'prefix') {this.value = '';
|
||||
this.style.color = "black";
|
||||
this.style.fontStyle = 'normal';
|
||||
}""",
|
||||
'onBlur': """if (this.value == '') {this.value = 'prefix';
|
||||
this.style.color = "gray";
|
||||
this.style.fontStyle = 'italic';
|
||||
}"""}))
|
||||
suffix = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
call = forms.CharField(label="Callname",
|
||||
initial='suffix',
|
||||
widget=TextInput(attrs={'size':'15',
|
||||
'style': 'font-style: italic; color: gray; ',
|
||||
'onFocus': """if (this.value == 'suffix') {this.value = '';
|
||||
this.style.color = "black";
|
||||
this.style.fontStyle = 'normal';
|
||||
}""",
|
||||
'onBlur': """if (this.value == '') {this.value = 'suffix';
|
||||
this.style.color = "gray";
|
||||
this.style.fontStyle = 'italic';
|
||||
}"""}))
|
||||
call = forms.CharField(label="Call",
|
||||
required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
patronymic = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
group_as = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
text = forms.CharField(label="Date",
|
||||
widget=TextInput(attrs={'size':'15'}))
|
||||
nick = forms.CharField(label="Nick",
|
||||
required=False,
|
||||
widget=TextInput(attrs={'size':'30'}))
|
||||
widget=TextInput(attrs={'size':'15'}))
|
||||
origin = forms.CharField(required=False,
|
||||
widget=TextInput(attrs={'size':'15'}))
|
||||
|
||||
class NameFormFromPerson(NameForm):
|
||||
class Meta:
|
||||
|
@ -438,9 +438,19 @@ def view_person_detail(request, view, handle, action="view"):
|
||||
name = person.name_set.get(preferred=True)
|
||||
except:
|
||||
name = Name(person=person, preferred=True)
|
||||
primary_surname = name.surname_set.get(primary=True)
|
||||
default_data = {"surname": primary_surname.surname,
|
||||
"prefix": primary_surname.prefix,
|
||||
"suffix": name.suffix or "suffix",
|
||||
"first_name": name.first_name,
|
||||
"name_type": name.name_type,
|
||||
"title": name.title,
|
||||
"nick": name.nick,
|
||||
"call": name.call,
|
||||
}
|
||||
pf = PersonForm(instance=person)
|
||||
pf.model = person
|
||||
nf = NameForm(instance=name)
|
||||
nf = NameForm(default_data, instance=name)
|
||||
nf.model = name
|
||||
elif action == "add":
|
||||
# make new data:
|
||||
|
Loading…
Reference in New Issue
Block a user