Temp fix for loading too many people for father/mother on Family edit page. Need to have an auto-complete solution
svn: r19836
This commit is contained in:
parent
e00296fa98
commit
f6d6b9c990
@ -127,6 +127,15 @@ class FamilyForm(forms.ModelForm):
|
|||||||
model = Family
|
model = Family
|
||||||
exclude = ["handle"]
|
exclude = ["handle"]
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(FamilyForm, self).__init__(*args, **kwargs)
|
||||||
|
self.fields['father'].queryset = Person.objects.filter(
|
||||||
|
gender_type=get_type_from_name(GenderType, "Male")) \
|
||||||
|
.order_by("name__surname__surname", "name__first_name")
|
||||||
|
self.fields['mother'].queryset = Person.objects.filter(
|
||||||
|
gender_type=get_type_from_name(GenderType, "Female")) \
|
||||||
|
.order_by("name__surname__surname", "name__first_name")
|
||||||
|
|
||||||
class EventForm(forms.ModelForm):
|
class EventForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Event
|
model = Event
|
||||||
|
@ -42,6 +42,16 @@ from webapp.grampsdb.profile import Profile
|
|||||||
#
|
#
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def get_type_from_name(the_type, name):
|
||||||
|
"""
|
||||||
|
Gets the type for a given name.
|
||||||
|
>>> get_type_from_name(GenderType, "Female")
|
||||||
|
<GenderType: Female>
|
||||||
|
>>> get_type_from_name(GenderType, "Male")
|
||||||
|
<GenderType: Male>
|
||||||
|
"""
|
||||||
|
return the_type.objects.get(name=name)
|
||||||
|
|
||||||
def get_type(the_type, data, get_or_create=False):
|
def get_type(the_type, data, get_or_create=False):
|
||||||
"""
|
"""
|
||||||
Gets the default row for a given Type and data. Data is
|
Gets the default row for a given Type and data. Data is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user