El Sun, 8 Nov 2009 08:00:56 -0800 (PST)
Zeynel <azeyn...@gmail.com> escribió:
> I am just learning Object Oriented terminology as I go along.
Not the best idea if you ask me. You should try "wetting your feet" with
simpler stuff first, and reading OOP theory.
That being said, I *guess* you can start out and do a lot of stuff with Django
without giving much thought of object oriented stuff.
Anyway, I'll give you some pointers for your questions:
http://docs.python.org/tutorial/classes.html
> Poll => name of the class? [my guess: this is just a name; it is not
> used in the database?]
Name of the class the example is defining. Django creates a table in the
database wich includes the name "poll" prefixed by the app's name.
> (models.Model): => what is this? [my guess: there is a django class
> called model and that has a subclass called Model and this statement
> says that Poll is a subcalls of Model which is subclass of model?]
Your guess is close, but not quite correct. 'model' is the name of a module
(a .py file containing code), read about that here:
http://docs.python.org/tutorial/modules.html
The rest of your guess is correct :)
> question => the name of the class variable? [my guess: This is a
> column in the database?]
Your guess is somewhat correct, there will be a column in a database named
"question" as a result from that line of code.
A class variable is something Django uses to make this happen.
> models. => what is this?
A Python module.
> .CharField(max_length=200) => [my guess: this defines the type of the
> data in the column "question"]
Yup, more on that here:
http://docs.djangoproject.com/en/dev/ref/models/fields/#ref-models-fi...
Good luck!
--
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/
|
|
application_pgp-signature_part
< 1K
Download
|