Asif Jamadar <[email protected]> writes:

> How can I use abstraction of base class in django forms?  In models we
> need to set "abstract=True" so that we can access the base class
> fields, similarly what concept I should follow to use abstraction in
> django forms.


I might be off on this since it's been a while but here is what I
remember. 

The abstract = True in Django is not *really* abstract base
classes. It's just a way of telling the ORM to not make tables for the
class and that it will only be subclassed. This is useful to build your
hierarchy properly without making unnecessary tables. However, this
doesn't have anything to with being "abstract" in the "abstract base
class sense".

Otherwise, Python has it's own models of inheritance and it's own scheme
for method resolution. Variables are in the object so it doesn't make
sense accessing the base class instances for these. Methods are
different and you can delegate to the base class methods using the
`super` keyword. There is also an abstract base class module[1] but I
haven't ever used it so I can't comment on that. 

[...]



Footnotes: 
[1]  http://docs.python.org/library/abc.html

-- 
~noufal
http://nibrahim.net.in

"Triumph without Victory, The Unreported History of the Persian Gulf War", 
-Headline published in the U.S. News & World Report, 1992.
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to