On Monday, 17 October 2011 12:04:41 UTC+1, youpsla wrote: > > Thanks you 2 for your answers. > > I think I've understood now. Again I apologize for the newby Python > question but I've read three times "Dive in Python" and it hasn't made > me thnigs clear. That's the reason why I've posted. > > I thought there was a hierarchy like this models.Model.CharField .... > > That's the reason why I didn't understood. > > Daniel, you said, that a method can be imported, this mean that an > external method (method from a class like Model) can't be used > directly in the Person class for example ? > > If I understand well, in "first_name = > models.CharField(max_length=30)", first_name is an instance of class > CharField. This instance send "30" to the "max_length" parameter of > class CharField. This parameter is used by an internal method of class > CharFiled. Is that right ? :-) > > Thanks again to all > > Regards > > Alain >
I'm having a little difficulty understanding your question (problème de traduction, sans aucun doute). Person inherits from models.Model, so all methods that are defined in the superclass are also available to the subclass - that's how Person gets methods such as `save`. As for `max_length=30`, when you instantiate a class Python calls the `__init__` method of that class, which in this case accepts a number of arguments including max_length. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/EsB6mXcOqjQJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.