Abstract classes and inhertience
Hola,
I have an abstract base class, Person, with three children:
Applicants, Students and Staff.
I have two questions.
As per docs ($PATH/topics/db/managers.html#custom-managers-and-model-inheritance)
I have three managers for the Abstract class:
people = models.Manager()
men = MaleManager()
women = FemaleManager()
with the appropriate definitions.
For some reason, I can't get
<child_class>.men.all() or <child_class>.women.all() to work. Any tips?
Secondly, I want the dob and gender to be using special widgets, so in
admin.py I have:
class PersonAdminForm(ModelForm):
class Meta:
model = Person
widgets = {
'dob': SelectDateWidget(),
'gender': RadioSelect(),
}
but then when I add the form to the StudentAdminForm or
ApplicantAdminForm, it fails on the first field that's not in Person.
Is there anyway to have a generic admin form?
cheers
L.
--
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, "We
look at the present through a rear-view mirror. We march backwards
into the future."
http://www.warrenellis.com/?p=14314
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home