Working on editing person
svn: r18342
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user